Mec Anim Dual Axis Animation Blending Question

Hi Everyone,

Im attempting to replicate a control system similar to dead ops arcade, where the left stick controls movement and the right controls your aiming.

Im attempting to take the position of the left and right sticks to match the correct animation but am having an extremely difficult time trying to figure out the best method to achieve this.

If my model is facing up I want the left stick to animate him walking forward backward left and right respectively, when he faces left for instance the animations now need to be rotated, so left becomes forward, down becomes left, right animates him walking backward ect.

Is there a way to multiply the values of the analog sticks to get a unique x and y combination for each animation… or is there a simpler way of doing this. I have rounded each direction to -1, -0.5, 1, 0.5, 1 for simplicity but am still struggling to figure out how to achieve my goal here. Please note the values in the motion panel in the inspector are way off and he only correctly animates when hes facing up with the walk forward and quarter turn right / left animations functioning.

Any help / a point in the right direction would be awesome :smile: - Let me know if I need to provide more clarity in what im trying to achieve here aswell.

Thanks.


I tell you what I did for a NON root motion scheme.

You need to know the angle between the point the character is facing (z=1), and the direction you are moving (get velocity in case of a rigidbody, a CC would need a calculation on displacement movement).

Because vector3.angle returns always positive number between 0 and 180, to know if this angle is “to the right” of z=1 or “to the left”, you need to do some more calculations, mainly a cross product between this vector3.angle you found and z=1. Once you have this, you can extract the sign (+ or -) of this cross product. Multiply this sign with the angle and for right / left you will have 90 or -90 (otherwise, you would have same 90 for both)

Finally do a substraction of the angle the character is facing, and the angle calculated above and you get a value between -360 and 360, two complete rounds. You just need to do a blend tree of these values (every animation will be two times in this blend tree, since you have 2 complete rounds)

Search for “signed vector3.angle” or “negative vector3.angle” in google and you will find answers.

I can share my script with you but it is done in playmaker.
If you don’t have playmaker, I can post screenshot by screenshot.

Good luck!