mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 18:41:10 +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
|
// if the head would intersect the near clip plane, we must push the camera out
|
||||||
glm::vec3 relativePosition = glm::inverse(_myCamera.getTargetRotation()) *
|
glm::vec3 relativePosition = glm::inverse(_myCamera.getTargetRotation()) *
|
||||||
(_myAvatar->getHead()->getPosition() - _myCamera.getTargetPosition());
|
(_myAvatar->getHead()->getPosition() - _myCamera.getTargetPosition());
|
||||||
const float HEAD_RADIUS = 0.1f;
|
const float HEAD_EXPANSION = 1.1f;
|
||||||
float pushback = relativePosition.z + _myCamera.getNearClip() + HEAD_RADIUS;
|
float pushback = relativePosition.z + _myCamera.getNearClip() + _myAvatar->getHeadHeight() * HEAD_EXPANSION;
|
||||||
if (pushback > 0.0f) {
|
if (pushback > 0.0f) {
|
||||||
_myCamera.setTargetPosition(_myCamera.getTargetPosition() +
|
_myCamera.setTargetPosition(_myCamera.getTargetPosition() +
|
||||||
_myCamera.getTargetRotation() * glm::vec3(0.0f, 0.0f, pushback));
|
_myCamera.getTargetRotation() * glm::vec3(0.0f, 0.0f, pushback));
|
||||||
|
|
|
@ -524,6 +524,11 @@ void Avatar::updateShapePositions() {
|
||||||
headModel.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) {
|
bool Avatar::findCollisions(const QVector<const Shape*>& shapes, CollisionList& collisions) {
|
||||||
// TODO: Andrew to fix: also collide against _skeleton
|
// TODO: Andrew to fix: also collide against _skeleton
|
||||||
//bool collided = _skeletonModel.findCollisions(shapes, collisions);
|
//bool collided = _skeletonModel.findCollisions(shapes, collisions);
|
||||||
|
@ -750,11 +755,6 @@ float Avatar::getSkeletonHeight() const {
|
||||||
return extents.maximum.y - extents.minimum.y;
|
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 {
|
bool Avatar::collisionWouldMoveAvatar(CollisionInfo& collision) const {
|
||||||
if (!collision._data || collision._type != MODEL_COLLISION) {
|
if (!collision._data || collision._type != MODEL_COLLISION) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -151,6 +151,8 @@ public:
|
||||||
virtual float getBoundingRadius() const;
|
virtual float getBoundingRadius() const;
|
||||||
void updateShapePositions();
|
void updateShapePositions();
|
||||||
|
|
||||||
|
float getHeadHeight() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateCollisionFlags();
|
void updateCollisionFlags();
|
||||||
|
|
||||||
|
@ -179,7 +181,6 @@ protected:
|
||||||
void setScale(float scale);
|
void setScale(float scale);
|
||||||
|
|
||||||
float getSkeletonHeight() const;
|
float getSkeletonHeight() const;
|
||||||
float getHeadHeight() const;
|
|
||||||
float getPelvisFloatingHeight() const;
|
float getPelvisFloatingHeight() const;
|
||||||
float getPelvisToHeadLength() const;
|
float getPelvisToHeadLength() const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue