SweepSingleByChannel
ABrainInteractiveObject* ABrainCharacter::CheckForInteractiveObjects() { FCollisionQueryParams traceParams = FCollisionQueryParams(FName(TEXT("Trace")), true, this); traceParams.bTraceComplex = true; traceParams.bTraceAsyncScene = true; traceParams.bReturnPhysicalMaterial = true; FHitResult hit(ForceInit); UWorld* world = GetWorld(); FVector startLocation = GetActorLocation() + FVector(0, 0, 64); // tweak pour prendre en compte la position de la camera. FVector endLocation = startLocation + (GetActorRotation().Vector() * _maxDistanceInteraction); world->SweepSingleByChannel(hit, startLocation, endLocation, FQuat::Identity, INTERACTIVE_OBJECT, FCollisionShape::MakeSphere(12.0f), traceParams); return Cast<ABrainInteractiveObject>(hit.GetActor()); }