How to rotate/tilt an actor in a desired direction, without affecting its Yaw?

I have an actor that represents a tree in the world. When it is hit, I want it to tilt away from the player. I have the attack direction vector. I have the attacker and the tree actor references. Here’s the catch. Using simple “MakeRotFromX” or “FindLookAtRotation” is not enough, because they rotate the tree on the Yaw axis. Which doesn’t make sense for a tree to rotate like that. It only has to tilt.

How do I calculate the new Roll and Pitch rotation for this tree actor to achieve this effect?

Does this works for you?


Oh my god, that’s so simple it’s genius. I thought I needed some complex math to calculate the new rotation and you give me this. Thank you for taking your time to help out!

1 Like

Glad to help!!

Sometimes there are problems that looks harder to solve and viceversa. :slight_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.