Issues with Pawn getting stuck on floor

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?

This is many years too late, but if anyone has this issue and is reading this, I had a kick function that lerped an enemy backwards to a forward vector point. I was using sweep so that it would knock into walls and stuff properly, but about half the time they wouldn’t lerp the full distance.

Turns out they were hitting the floor multiple times which slowed the lerp down, so I made it so that I only lerped the X and Y axis of the second destination value, and kept the original Z axis for the second lerp value (so essentially the Z location was the same for both lerps), and this seems to have solved it for now!