Thursday, June 16, 2022
HomeGame Developmentunity - Changing native rotation knowledge from one rig onto one other...

unity – Changing native rotation knowledge from one rig onto one other of a special orientation


First, we have to convert the animated native rotation quaternion q into the coordinate area of the brand new guardian. We do this by remapping every axis individually. If altering handedness, we’d additionally apply an additional negation to x,y,z, however that does not seem to use right here in response to your diagrams.

var transformed = new Quaternion(
    -q.z, // T_Parent.x = -O_Parent.z
    -q.x, // T_Parent.y = -O_Parent.x
    -q.y, // T_Parent.z = -O_Parent.y
     q.w  // angle similar
);

Making use of this transformed native rotation to a baby below a guardian with orientation T_Parent will yield a web orientation equal to O_Child (ie. its z+ axis factors within the course indicated by O_Child.z), which isn’t but fairly what we wish.

So then we have to apply an additional twist to account for the distinction between O_Child and T_Child:

var adapter = Quaternion.LookRotation(
    Vector3.up,   // T_Child.z+ = O_Child.y+
    Vector3.proper // T_Child.y+ = O_Child.x+
);

Then we are able to chain these two results:

var end result = transformed * adapter;

It is nonetheless early morning so there is a danger I’ve inverted one among these operations, however an answer following that tough define ought to get you getting in the correct course.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments