Is there a Rotation Follows Velocity for characters?

I’m using the default sidescroller template with a custom character who’s set up almost the same way as the default template character.

It’s rotating to the direction he’s moving (via “Orient rotation to movement” and Rotation Rate Yaw: 720), just like the default does. is perfect for walking, but insufficient for swimming.

The character can swim, in 8 directions via WASD, or 360 via touch.

  • Rotating the mesh on the x axis in the viewport gives me the kind of rotation I expect, but unfortunately,
    adjusting the Roll (x?) Rotation Rate under Character Movement (General Settings) doesn’t seem to do anything.

  • Adjusting the Rotation Rate for Pitch (y?) makes the character rotate when swimming, but in unexpected directions.

  • Adjusting the Yaw Rotation Rate (z) makes it turn as expected.

Maybe I shouldn’t use these values to rotate the character when he’s swimming?

I found out that projectiles have a “Rotation Follows Velocity” node, but it seems it only takes in a projectile. I’m pretty sure would give me exactly what I want, but I’m not sure how I could modify it to work with a character.

Anyone know how I might get the character’s rotation to follow its velocity? I’ve spent a couple hours trying to get it to work but haven’t really made much progress. A link to an in depth tutorial about character/capsulecomponent rotations would be extremely appreciated!

Thanks

No need for that node. Just get your Character’s velocity and use “Make Rot From X” node to make the rotation for your Character, and finally set your character’s rotation using “Set Actor Rotation” node.

1 Like

Beware that only when the velocity is bigger than some value(according to your case),the rotation is valiable to use, or else it will be some unexpect situation.

Hey BlinkSpark!
Awesome, thanks a bunch for that info.

When you say set your “character’s rotation” would it be the rotation of the capsule component? (the skeletal mesh is parented to the capsule component just like the default template character is…)

Anyway, I’ll try to hook that in right now!

Edit: GetPlayerPawn seems like that’s what I should be getting the velocity from and setting the rotation of. (?)

BlinkSpark,
Please disregard the question I asked about which character component to use. GetPlayerPawn does the trick. I gotta muck with some values to get the proper rotation (seems like it’s fighting with the Z). Regardless, is totally what I wanted

Thank you very much for taking the time to respond and lay it out for me. Much appreciated. I’ll take note of the warning regarding low velocity producing unintended behavior.


works for me pretty well. (Minimum Velocity to Rotation set to 250)
Thanks for pointing me into the right direction.