Download

Trace Wont follow static mesh component rotation

Im basically just doing a trace from a “Door” component thats parented to a room blueprint, this is done so i can check if the door trace hits another door and then snap both of them together

Using the following code


bool ATTRoom::DoorDirectionsMatch(ATTRoom* OtherRoom)
 {
     FVector OurLocNorm;
     FVector OtherLocNorm;
     FVector Direction;
     FCollisionQueryParams RV_TraceParams = FCollisionQueryParams(FName(TEXT("RV_Trace")), true, this);
     RV_TraceParams.bTraceComplex = true;
     RV_TraceParams.bTraceAsyncScene = true;
     RV_TraceParams.bReturnPhysicalMaterial = false;
     //Re-initialize hit info
     FHitResult RV_Hit(ForceInit);
     OurLocNorm = GetRoomDoors()->GetComponentLocation();
     OtherLocNorm = OtherRoom->GetRoomDoors()->GetComponentLocation();
 
 
     Direction = GetRoomDoors()->GetComponentRotation().Vector().ForwardVector; // get the forward vector of the door
 
     GetWorld()->LineTraceSingle(RV_Hit, OurLocNorm, OurLocNorm + Direction * 500,  ECC_WorldDynamic, RV_TraceParams);
 
     DrawDebugLine(
         GetWorld(),
         OurLocNorm,
         OurLocNorm + Direction * 500, // 
         FColor(255, 0, 0),
         false, -1, 0,
         12.133
         );
 
     
 // other code
 }

The trace is displayed perfectly and its done “forward” from the Room Door as it should be,

But if i rotate the Room 90 degrees

That happens… the trace should always point forward from the door but as it can be seen above once the room is rotated the trace wont follow along…