- Home /
Finding angle between two quaternions/lookrotation
I am not mathematically smart. This is going to be fun :)
I've got a humanoid rig on scene where I am using script to twist the spine, atm it "works" but it's not pretty. The gameplay is a "3rd person over the shoulder esque" shooter, and for the firing mechanism i want the hip to maintain rotation while blending rotation up the spine until the neck/shoulders are aiming where the player is shooting. At the moment for short hand I have the bottom spine simply LookAt(targetPos), it works, its ugly.
What I'm trying to do is get the rotation between two rotations, i have the base object facing the direction the player is moving and the top of the spine aiming where the player is shooting, i want to script the other spine bones to face between these angles... am i making any sense? :/
so i want; A - base rotation B - middle rotation C - end rotation
A is set by WASD, C is set by raycast.mousepos. i want the half way point between A and C to apply to B.
as always, sorry for my terrible explinations and/or over-complicating a simple question maybe :/ i never know lol
p.s.- I would love some kind of "Quaternion nextRot = quaternion.lerp (A, B, time, return nextStep)" :)
Answer by Derenger21 · Aug 25, 2017 at 03:27 AM
So, I'm an idiot... Somehow i didnt noticed one of my bones are skinned backwards (180 on y) so any rotations i try to do are coming out backwards anyway and well, i cant do this til i fix it so... yea... oops. lol.
Your answer