Sunday, December 11, 2022
HomeGame Developmentc# - Root movement roll animation in 2D Freeform Cartesian mix tree....

c# – Root movement roll animation in 2D Freeform Cartesian mix tree. Character rolling in native coordinates, I need it in world coords (Unity)


I’am at the moment prototyping a high down 3D sport in Unity 2021.3.4f1.

My character strikes with normal “WASD” and all the time faces in direction of my cursor’s location on the display screen. The digital camera is fastened and wont rotate with the character in any respect.
Merely described in beneath image:
enter image description here

My present resolution to roll on the appropriate angle is with a 2D freeform Cartesian animator mix tree, please see beneath hooked up SS on arrange and script to manage the Parameters: MoveX and MoveZ:
enter image description here
enter image description here

(Please disregard the * -1 within the GetAxis, its merely corrected for my character that is 180 levels rotated in sport)

Principally transferring character “up” with “W” and urgent roll bind with roll the character “up”. No downside to this point.

My subject with the offered resolution is when the character begins to rotate in direction of the cursor. GetAxis works in native coordinates described in beneath image:

enter image description here

As quickly as I rotate my character the coordination system rotates with it domestically:
enter image description here

This causes main points with my roll animation that makes use of root movement and principally sprint the character in its native coordinate system, however I need it to sprint in my world coordinates. Attempting to explain within the some what complicated image beneath:
enter image description here

This video is showcasing the difficulty in sport:
https://streamable.com/ko63c2

You’ll be able to clearly see in first rolls that the character rolls within the path that the character is transferring. When rotating 180 levels its precisely mirrored.

My first thought since Im not a to good coder is to do an enormous If/else assertion controlling my MoveX and MoveZ parameters when transferring with WASD. Or I substitute the Enter.GetAxis to get it in world coordinates (havent discovered any method to do that)…

What’s the easiest and most elegant method of reaching above outcomes?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments