Rotate an object in the direction the player is facing

Hey,

I have a bunch of tree objects which you chop down. I want for every time you hit the tree it rotate away from the player, so rotate in the direction the player is facing essentially. I am new and am really not quite sure on how I could achieve this.

Is there any way to calculate a vector to do this based on player forward direction?

Thanks.

yes there is way: “make rotatation”
You have bunch of them.

Then there is find look at rotation.
In your case multiply that forward vector by for eg 10000 or so. add it to tree location. Then make “find look at rotation” from tree location to that 10k distance point.

This does sort of work how I want. However Instead of it rotating/pointing toward where the player is looking I just want the tree to lean away from the direction the player is facing.

Depending on how you mean rotate, you can use several methods, since if the player is not pointing perfectly towards the tree when copping, your tree would also fall in a funny direction.

I would use the “Find Look At” Rotation, which makes the tree face the direct line from tree to player, or face perfectly away (Depending on you you put in start and target pins.). You use the Z/Roll value of this rotation and set this as the Z/Roll value and plug it in a Set World Rotation. As the X/Pitch OR Y/Yaw rotation you insert the amount you want the tree to tilt with, as this now controls the rotation away fron the player.

If you want it to tilt a bit more per hit, you can now use an Add World Rotation node, and add the desired tilt degrees to the X or the Y value (depending on what you used before), and just leave the other add rotion values as Zero

Hope this makes sense :slight_smile: