Hi everyone, I have a problem right now with line traces, I’m trying to make a line trace that goes from the camera to the world, so the trace actually get shot from the camera position but I can’t find any place where to set the rotation for the trace to be shot, so is there anyway to tell the trace the rotation it needs to to use so it goes to my world?
The is the original line trace that I’m getting from the code:
This is what I desire to get, the line:
This is the code I’m using:
FVector startTraceLocation;
FRotator startRotacionLocation;
mainCamera->GetActorEyesViewPoint(startTraceLocation, startRotacionLocation);
const FName TraceTag("MyTraceTag");
GetWorld()->DebugDrawTraceTag = TraceTag;
FCollisionQueryParams RV_TraceParams = FCollisionQueryParams(FName(TEXT("RV_Trace")), true, this);
RV_TraceParams.bTraceComplex = true;
RV_TraceParams.bTraceAsyncScene = true;
RV_TraceParams.bReturnPhysicalMaterial = false;
RV_TraceParams.TraceTag = TraceTag;
//Re-initialize hit info
FHitResult RV_Hit(ForceInit);
//call GetWorld() from within an actor extending class
GetWorld()->LineTraceSingle(RV_Hit, //result
startTraceLocation, //start
FVector(startTraceLocation.X, startTraceLocation.Y, 0) + (startRotacionLocation.Vector() * 256), //end
ECC_WorldDynamic, //collision channel
RV_TraceParams);

