When the pawn reaches a certain point I want to rotate it using AddActorWorldRotation until it is facing the StartingLocation which is the place where it was placed the first time, stored as a vector, but for that, I need to know the angle between the forward vector and the StartingLocation. How do I do that?
my game is very animation-senzitive, I can’t afford any snap in the movement that is why I am using add movement input and add actor world rotation together, all these powered up by some timelines and I plan to use that angle to set the length of my timiline. For example, if there are 110 degrees between the forward vector and the starting location I plan to set the timelime length to 11 and move 10 degrees every second. I’ve tried to use the dot product but either my math is broken or the algorithm is not doing what I intend.
You actually do not need the angle for that. A rotator should be enough.
You can Find Look At Rotation
(current actor position & starting position) and then keep Adding Actor World Rotation until forward vector Rotation from X
(closely enough) matches the one spat out by the Find Look
node.
But perhaps you do not need to AddActorWorldRotation - not sure how what you’re doing is supposed to work, but it can definitely be achieved with rInterpTo
or Lerping rotators - a more subtle approach. But again, you may require specific control over rotation.
my game is very animation-senzitive, I can’t afford any snap in the movement that is why I am using add movement input and add actor world rotation together, all these powered up by some timelines and I plan to use that angle to set the length of my timiline. For example, if there are 110 degrees between the forward vector and the starting location I plan to set the timelime length to 11 and move 10 degrees every second. I’ve tried to use the dot product but either my math is broken or the algorithm is not doing what I intend.
So a Pawn moving forward and minding its own business bumps into the player, and rotates towards its starting position:
Many ways of setting it up, the right way will depend on the details.