I’m trying to rotate a 3d vector [input] so that:
local forward = (0,0,1) => input is not rotated = (1,0,0) => input is rotated 90 deg = (0,0,-1) => input is rotated 180 deg = (-1,0,0) => input is rotated 270 deg // movement is on the xz plane
Basically, I’ve got player input as a vec3 in a top down / twin stick shooter game and i’d like to use to it drive the blend tree animations. However, animations are relative to the direction the player is facing, so the input values need to be rotated to map to the proper animation values. For example if the player is pressing the [move right key] and facing east, i’d like to play the forward animation. If the player is facing south and presses the same [move right key] i’d like to play the strafe to the left animation.
I think Rotate a Vector3 direction - Questions & Answers - Unity Discussions is a good start but I couldn’t get figure out how to properly apply it here.
How can I achieve this effect? Thanks for any help!