mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 19:34:02 +02:00
Use the head height to determine the pushback amount.
This commit is contained in:
parent
5776514e6a
commit
add7bb26ed
3 changed files with 9 additions and 8 deletions
|
@ -532,8 +532,8 @@ void Application::paintGL() {
|
|||
// if the head would intersect the near clip plane, we must push the camera out
|
||||
glm::vec3 relativePosition = glm::inverse(_myCamera.getTargetRotation()) *
|
||||
(_myAvatar->getHead()->getPosition() - _myCamera.getTargetPosition());
|
||||
const float HEAD_RADIUS = 0.1f;
|
||||
float pushback = relativePosition.z + _myCamera.getNearClip() + HEAD_RADIUS;
|
||||
const float HEAD_EXPANSION = 1.1f;
|
||||
float pushback = relativePosition.z + _myCamera.getNearClip() + _myAvatar->getHeadHeight() * HEAD_EXPANSION;
|
||||
if (pushback > 0.0f) {
|
||||
_myCamera.setTargetPosition(_myCamera.getTargetPosition() +
|
||||
_myCamera.getTargetRotation() * glm::vec3(0.0f, 0.0f, pushback));
|
||||
|
|
|
@ -524,6 +524,11 @@ void Avatar::updateShapePositions() {
|
|||
headModel.updateShapePositions();
|
||||
}
|
||||
|
||||
float Avatar::getHeadHeight() const {
|
||||
Extents extents = getHead()->getFaceModel().getBindExtents();
|
||||
return extents.maximum.y - extents.minimum.y;
|
||||
}
|
||||
|
||||
bool Avatar::findCollisions(const QVector<const Shape*>& shapes, CollisionList& collisions) {
|
||||
// TODO: Andrew to fix: also collide against _skeleton
|
||||
//bool collided = _skeletonModel.findCollisions(shapes, collisions);
|
||||
|
@ -750,11 +755,6 @@ float Avatar::getSkeletonHeight() const {
|
|||
return extents.maximum.y - extents.minimum.y;
|
||||
}
|
||||
|
||||
float Avatar::getHeadHeight() const {
|
||||
Extents extents = getHead()->getFaceModel().getBindExtents();
|
||||
return extents.maximum.y - extents.minimum.y;
|
||||
}
|
||||
|
||||
bool Avatar::collisionWouldMoveAvatar(CollisionInfo& collision) const {
|
||||
if (!collision._data || collision._type != MODEL_COLLISION) {
|
||||
return false;
|
||||
|
|
|
@ -151,6 +151,8 @@ public:
|
|||
virtual float getBoundingRadius() const;
|
||||
void updateShapePositions();
|
||||
|
||||
float getHeadHeight() const;
|
||||
|
||||
public slots:
|
||||
void updateCollisionFlags();
|
||||
|
||||
|
@ -179,7 +181,6 @@ protected:
|
|||
void setScale(float scale);
|
||||
|
||||
float getSkeletonHeight() const;
|
||||
float getHeadHeight() const;
|
||||
float getPelvisFloatingHeight() const;
|
||||
float getPelvisToHeadLength() const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue