I am moving my Pawn using SetActorLocation() however sometimes it’s getting stuck to the floor and I have to work-around this using:
FVector Location = GetActorLocation() + MovementVector * Speed * DeltaTime;
FHitResult HitResult;
if (!SetActorLocation(Location, true, &HitResult)) {
// If we are blocked by the floor, then force the movement
AActor* BlockingActor = HitResult.GetActor();
if (BlockingActor && BlockingActor->ActorHasTag(FloorTag)) {
SetActorLocation(Location, false);
}
}
If I call SetActorLocation(Location, false); (i.e. without a sweep) then the pawn never gets stuck, but I do not receive collision callbacks.
Something tells me there must be an easier way?
Also I don’t really want to know if I have collided with the floor, but don’t seem to be able to set-up the collision profile to avoid it; obviously if I ignore WorldStatic objects then the pawn falls through the floor, so I need to block it, but don’t want to be told about collisions with the floor; is it possible to do that?