The IK was assiming that the "Hips" bone index was always 0.
This was not the case for Owen. Now we lookup the Hips index
and cache it for use during the hipsOffset computation.
MyAvatar: refactored updateFromHMDSensorMatrix() a bit by splitting it into several methods, because
it was getting quite large and becoming hard to follow.
* beginStraighteningLean() - can be called when we would like to trigger a re-centering action.
* shouldBeginStraighteningLean() - contains some of the logic to decide if we should begin a re-centering action.
for now it encapulates the capsule check.
* processStraighteningLean() - performs the actual re-centering calculation.
New code was added to MyAvatar::updateFromHMDSensorMatrix() to trigger re-centering when the avatar speed rises
over a threshold.
Secondly the Rig::computeMotionAnimationState() state machine for animGraph added a state change hysteresis
of 100ms. This hysteresis should help smooth over two issues.
1) When the delta position is 0, because the physics timestep was not evaluated.
2) During re-centering due to desired motion, the avatar velocity can fluctuate causing undesired animation state fluctuation.
Only the JointState._defaultTranslation needs to be multiplied
by the unitScale in JointState::translationIsDefault(). This
was incorrectly flagging some non-animated joints as animated.
Do the following things to the translations
1. scale by the model offset, this should move the translations into the correct units (meters).
2. compute the ratio between the bone length in the animation and the skeleton.
3. subtract the anim translation from the first translation frame in the animation
effectively turning it into a bind pose delta translation.
4. apply bone length ratio to the resulting delta.
5. set the final translation to be the skeleton rel bind pose + this scaled delta translation
The calculation that determined where the body position relative to the HMD
was incorrect, one of the components was in the wrong coordinate frame.
Now use the skeleton's bind pose to compute the proper avatar offsets for the eyes, neck and hips.
Use these offsets to calculate where the hips should be given a specific hmd position and orientation.
Also, added a bug fix for Rig, which would cause a -1 index deference when an avatar was missing
certain named joints, such as, "LeftEye", "Neck" and "Head".