How do I subtract one rotation from another?
This is my problem: I have a head and torso both looking at the mouse point in 3d but since the only way I could get it to work was to make the spine mimic the head rotation. So since the head is connected to the spine, it rotates a bit extra and thus does not look at the target/mouse point correctly.
So how would I go about doing this? Subtracting the final head rotation by the spine rotation?
I am using the mecanim headlook at.
This is where my spine turns according to head:
LateUpdate(){
spinebone.localrotation = headbone.localrotation;
// … and this is the mecanim code for the head look:
anim.SetLookAtPosition(ahit.point);
lookWeight = Mathf.Lerp(lookWeight, 1f, Time.deltaTime*lookSmoother);
}
So yeah I need to get the head to minus a few degrees whilst turning to look to compensate for the extra turn thanks to the torso turning underneath.
Hope you can help… Please.