Calculate head height based on skeleton model mesh if no head model

This fixes the problem of some skeleton models with heads having
display names rendering through them.
This commit is contained in:
David Rowe 2015-03-16 15:47:54 -07:00
parent 08c95555dd
commit 913527eaa3

View file

@ -1017,10 +1017,11 @@ float Avatar::getHeadHeight() const {
if (!extents.isEmpty()) {
return extents.maximum.y - extents.minimum.y;
}
extents = _skeletonModel.getMeshExtents();
glm::vec3 neckPosition;
glm::vec3 headPosition;
if (_skeletonModel.getNeckPosition(neckPosition) && _skeletonModel.getHeadPosition(headPosition)) {
return glm::distance(neckPosition, headPosition);
if (!extents.isEmpty() && _skeletonModel.getNeckPosition(neckPosition)) {
return extents.maximum.y / 2.0f - neckPosition.y + _position.y;
}
const float DEFAULT_HEAD_HEIGHT = 0.1f;
return DEFAULT_HEAD_HEIGHT;