Hello,
My player can position himself to chop down a tree from any angle (decided based on camera position when the interaction begins).
When the tree is set to fall, I want to give it a ‘nudge’ rotationally of a few degrees in the direction of the character’s right vector, before enabling physics, so as to indirectly give the player control over the fall direction.
This would be simple enough if I could set the tree’s yaw angle initially toward the player using a Find Look at Rotation, as then the roll axis would be aligned such that I could simply add rotation to it and get the desired result.
However, it would of course look weird if a tree changed yaw like that, so what I actually need to do is add both pitch and roll in some amount each, that gives the same effect without altering the yaw.
I cannot figure out the theory for how to do this, and was wondering if anyone could help me do so? It’d be much appreciated if you can, both for this task and for the general principle if I want to do something similar for anything else.
I don’t know about others reading this post, but I’m having a hard time understanding exactly what you’re trying to accomplish. Why can you not just modify the roll to begin with?
If I understand this correctly you want to play some sort of procedural rotation animation on the tree when you chop it down. The animation is a rotation towards the right vector of the player pawn. You don’t need to use FindLookAt you can just get the relevant right vector directly from the Pawn.
The logic is a bit like this:
Pawn chops the tree > Tree detects the Pawn chopping > Tree decreases health until the “chopped down” event > that event stores the “Right Vector” of the pawn and starts a timeline > On timeline tick you add rotation to the tree using the stored right direction.
For additional animation control you could use curve assets to multiply your values with. While the timeline plays you can then get value Y of the curve over X time.
Hi guys,
Sorry for the 2am posting, I can see why its a bit unclear.
I made a little picture to hopefully better show what I meant.
Since the yaw of the tree in the world doesn’t necessarily line up nicely with the position of the player in any single axis (X or Y) I couldn’t figure out how to add rotation to both axes in the necessary amount of produce a final rotation along the purple arrow, parallel to the character’s right vector - and I can’t rotate the tree directly to make an alignment that allows me to rotate along a single axis, nice and simply, because I don’t want the tree’s yaw to actually change to face the character, because of the obvious visual weirdness that would create.
Having slept on it though - I realised rather than trying to manipulate the tree’s rotation directly, I could just add an arrow component and orient that arrow to face the character, before attaching the components I needed to rotate to said arrow. Then I just rotate the arrow in X and let the attachment figure out what the X and Y values for the attached component need to be. This seems to be giving me the exact end result I was looking for.
I appreciate the responses and hopefully if anyone else is overthinking a problem of a similar nature this will help!
I don’t have an answer but these rotations and directions and transforms in relation with other transforms are a big issue for me. I’m losing more dev time trying to figure this out than doing anything else.