mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 16:50:43 +02:00
Fix first person camera positioning to correspond to eyelevel.
This makes sure the lookatVectors don't seem to point upwards when looking at you.
This commit is contained in:
parent
718fa291cf
commit
dd2655825a
3 changed files with 7 additions and 2 deletions
|
@ -407,7 +407,7 @@ void Application::paintGL() {
|
||||||
|
|
||||||
} else if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
|
} else if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
|
||||||
_myCamera.setTightness(0.0f); // In first person, camera follows head exactly without delay
|
_myCamera.setTightness(0.0f); // In first person, camera follows head exactly without delay
|
||||||
_myCamera.setTargetPosition(_myAvatar.getUprightHeadPosition());
|
_myCamera.setTargetPosition(_myAvatar.getUprightEyeLevelPosition());
|
||||||
_myCamera.setTargetRotation(_myAvatar.getHead().getCameraOrientation());
|
_myCamera.setTargetRotation(_myAvatar.getHead().getCameraOrientation());
|
||||||
|
|
||||||
} else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
|
} else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
|
||||||
|
|
|
@ -370,7 +370,11 @@ glm::vec3 Avatar::getUprightHeadPosition() const {
|
||||||
return _position + getWorldAlignedOrientation() * glm::vec3(0.0f, _pelvisToHeadLength, 0.0f);
|
return _position + getWorldAlignedOrientation() * glm::vec3(0.0f, _pelvisToHeadLength, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::vec3 Avatar::getUprightEyeLevelPosition() const {
|
||||||
|
const float EYE_UP_OFFSET = 0.36f;
|
||||||
|
glm::vec3 up = getWorldAlignedOrientation() * IDENTITY_UP;
|
||||||
|
return _position + up * _scale * BODY_BALL_RADIUS_HEAD_BASE * EYE_UP_OFFSET + glm::vec3(0.0f, _pelvisToHeadLength, 0.0f);;
|
||||||
|
}
|
||||||
|
|
||||||
void Avatar::updateThrust(float deltaTime, Transmitter * transmitter) {
|
void Avatar::updateThrust(float deltaTime, Transmitter * transmitter) {
|
||||||
//
|
//
|
||||||
|
|
|
@ -171,6 +171,7 @@ public:
|
||||||
glm::vec3 getGravity () const { return _gravity; }
|
glm::vec3 getGravity () const { return _gravity; }
|
||||||
|
|
||||||
glm::vec3 getUprightHeadPosition() const;
|
glm::vec3 getUprightHeadPosition() const;
|
||||||
|
glm::vec3 getUprightEyeLevelPosition() const;
|
||||||
|
|
||||||
AvatarVoxelSystem* getVoxels() { return &_voxels; }
|
AvatarVoxelSystem* getVoxels() { return &_voxels; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue