mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 14:03:55 +02:00
Better head heights for headless skeletons.
This commit is contained in:
parent
94a46b4a21
commit
71231268a5
2 changed files with 13 additions and 1 deletions
|
@ -776,7 +776,16 @@ float Avatar::getSkeletonHeight() const {
|
|||
|
||||
float Avatar::getHeadHeight() const {
|
||||
Extents extents = getHead()->getFaceModel().getBindExtents();
|
||||
return extents.maximum.y - extents.minimum.y;
|
||||
if (!extents.isEmpty()) {
|
||||
return extents.maximum.y - extents.minimum.y;
|
||||
}
|
||||
glm::vec3 neckPosition;
|
||||
glm::vec3 headPosition;
|
||||
if (_skeletonModel.getNeckPosition(neckPosition) && _skeletonModel.getHeadPosition(headPosition)) {
|
||||
return glm::distance(neckPosition, headPosition);
|
||||
}
|
||||
const float DEFAULT_HEAD_HEIGHT = 0.1f;
|
||||
return DEFAULT_HEAD_HEIGHT;
|
||||
}
|
||||
|
||||
bool Avatar::collisionWouldMoveAvatar(CollisionInfo& collision) const {
|
||||
|
|
|
@ -47,6 +47,9 @@ public:
|
|||
/// \return true if point is within current limits
|
||||
bool containsPoint(const glm::vec3& point) const;
|
||||
|
||||
/// \return whether or not the extents are empty
|
||||
bool isEmpty() { return minimum == maximum; }
|
||||
|
||||
glm::vec3 minimum;
|
||||
glm::vec3 maximum;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue