Is there any way to redirect the root motion according to the angle of the surface?! I’m developing a mechanics that has no specific gravity point and I need to make my character be able to walk on any surface.
Even tried using the function Orthonormalize () to handle the vector animator.deltaPosition and multiplies it by animator.deltaPosition.magnitude to get an approximate value, but still did not work = /.
@[HitalloExiled]( https://discussions.unity.com/t/517238 members/hitalloexiled.431669/), did you ever find out how to get this working? And if so, can you recall this after many years? I’m looking for the same solution. Cheers.
Considering they have only 1 post from 2013. I doubt they’re going to respond.
As for getting this… usually I take the cross product of the ground normal with the forward normal that we want to fix, giving us a right vector. Then crossing that with the normal again to get a new forward that is tangent to the ground.
Main thing you have to check for is if the forward vector and ground normal are parallel (resulting in a 0-vector from the cross-product). In that case well… you’re character is facing a weird direction and you need to adjust for that. Usually I take the character’s up axis… find the quaternion from that toward the normal. And then with that information fix my forward normal and return back to the previous algorithm… due to the way quats work though the path may seem a bit jarring (and is why I don’t use it always), but it works to fix the problem at that moment.
You’re probably right about that responding. But I’m glad you noticed it though.
I will try and build your approach. Although my root motion is about a cube that rotates on all sides, so I’ll have to build a work around with (probably 6 raycasts) when what side is forward and when not.