Rotate Pawn Toward Direction of Motion

Hey, I’m trying to simplify how I am currently rotating my pawn so that it faces the direction it is moving. There’s a function for this in Character Movement but I am using a pawn (I know Default Pawn has this as well) but I would like to build it manually for the sake of control. What I am doing right now is simply checking which key is down and lerping rotation to a preset angle stored in a float. But I feel like there’s a better way, say for instance maybe get the difference between the vector of movement and the forward vector and lerp those.

This is what I’ve tried so far. The results are a tad messy.

I’m not doing the exact same thing, but this code was taken from my follow camera I set up last year. My camera follows a skateboard based on its world velocity.

Try something like this, where root is the root component of the pawn and only the mesh rotates.

1 Like