mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 13:43:49 +02:00
Head height's kind of screwy; let's use the eye position.
This commit is contained in:
parent
add7bb26ed
commit
faf8c35358
3 changed files with 11 additions and 11 deletions
|
@ -524,16 +524,17 @@ void Application::paintGL() {
|
|||
|
||||
} else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
|
||||
_myCamera.setTightness(0.0f);
|
||||
float headHeight = _myAvatar->getHead()->calculateAverageEyePosition().y - _myAvatar->getPosition().y;
|
||||
glm::vec3 eyePosition = _myAvatar->getHead()->calculateAverageEyePosition();
|
||||
float headHeight = eyePosition.y - _myAvatar->getPosition().y;
|
||||
_myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _myAvatar->getScale());
|
||||
_myCamera.setTargetPosition(_myAvatar->getPosition() + glm::vec3(0, headHeight, 0));
|
||||
_myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI, 0.0f)));
|
||||
|
||||
// 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_EXPANSION = 1.1f;
|
||||
float pushback = relativePosition.z + _myCamera.getNearClip() + _myAvatar->getHeadHeight() * HEAD_EXPANSION;
|
||||
(eyePosition - _myCamera.getTargetPosition());
|
||||
const float PUSHBACK_RADIUS = 0.01f;
|
||||
float pushback = relativePosition.z + _myCamera.getNearClip() + _myAvatar->getScale() * PUSHBACK_RADIUS;
|
||||
if (pushback > 0.0f) {
|
||||
_myCamera.setTargetPosition(_myCamera.getTargetPosition() +
|
||||
_myCamera.getTargetRotation() * glm::vec3(0.0f, 0.0f, pushback));
|
||||
|
|
|
@ -524,11 +524,6 @@ 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);
|
||||
|
@ -755,6 +750,11 @@ 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,8 +151,6 @@ public:
|
|||
virtual float getBoundingRadius() const;
|
||||
void updateShapePositions();
|
||||
|
||||
float getHeadHeight() const;
|
||||
|
||||
public slots:
|
||||
void updateCollisionFlags();
|
||||
|
||||
|
@ -181,6 +179,7 @@ protected:
|
|||
void setScale(float scale);
|
||||
|
||||
float getSkeletonHeight() const;
|
||||
float getHeadHeight() const;
|
||||
float getPelvisFloatingHeight() const;
|
||||
float getPelvisToHeadLength() const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue