Hi everyone !
I’m trying manage the collisions in a pawn by LineTraceSingle. My pawn is always falling untiI it collides with a mesh. I calculate the collision with this code:
FVector StartTrace = m_lastPosition; // pawn's position in last frame.
const FVector EndTraceDown = GetActorLocation() - GetActorUpVector() * m_capsuleHeight;
bool collisionDown = GetWorld()->LineTraceSingle(OutTraceResultDown, StartTrace, EndTraceDown, COLLISION_PLAYER, TraceParams));
if(collisionDown)
SetActorLocation(HitLocation - GetActorUpVector() * m_capsuleHeight);
This code usually works fine, but when I change window while the viewport is playing, the pawns doesnt collide until I open again the viewport.
I dont understand what it happen. Any ideas?
I have so much code to paste, so I have simplified it , sorry .