highfidelity/hifi — pull request #3349 by AndrewMeadows (2014-09-04 17:16:59+00:00)
Title: fix for bad avatar bounding shape on resize

This is a fix for:

Bounding collision shape gets displaced when you resize your avatar
https://worklist.net/20001

The bounding shape for the avatar is recomputed whenever the avatar's shape or size changes: we build the skeleton joint shapes, we compute their bounding box, and we harvest the box's dimensions for the avatar's bounding capsule: length, radius, and offset. The bounding box is computed in the frame of the shapes, which depend on the transform of the root joint.

The problem is that the avatar's root joint sometimes has a non-zero offset, and sometimes has been slammed to zero (because it defines the origin in the avatar frame). I haven't figured out why it is sometimes right and sometimes wrong in the two code paths (on load vs avatar resize).

The solution is to always compute the bounding capsule's offset relative to the position of the skeleton's root joint, whatever it happens to be.