mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
Remove unused variables, change orbit pitch behavior (closes #1582).
This commit is contained in:
parent
bb41fe6ddb
commit
765f98fadc
1 changed files with 11 additions and 8 deletions
|
@ -175,8 +175,6 @@ void MyAvatar::simulate(float deltaTime, Transmitter* transmitter) {
|
|||
|
||||
// Compute instantaneous acceleration
|
||||
float forwardAcceleration = glm::length(glm::dot(getBodyFrontDirection(), getVelocity() - oldVelocity)) / deltaTime;
|
||||
const float ACCELERATION_PITCH_DECAY = 0.4f;
|
||||
const float ACCELERATION_PULL_THRESHOLD = 0.2f;
|
||||
const float OCULUS_ACCELERATION_PULL_THRESHOLD = 1.0f;
|
||||
const int OCULUS_YAW_OFFSET_THRESHOLD = 10;
|
||||
|
||||
|
@ -475,14 +473,19 @@ void MyAvatar::loadData(QSettings* settings) {
|
|||
}
|
||||
|
||||
void MyAvatar::orbit(const glm::vec3& position, int deltaX, int deltaY) {
|
||||
glm::vec3 vector = getPosition() - position;
|
||||
// first orbit horizontally
|
||||
glm::quat orientation = getOrientation();
|
||||
glm::vec3 up = orientation * IDENTITY_UP;
|
||||
const float ANGULAR_SCALE = 0.5f;
|
||||
glm::quat rotation = glm::angleAxis(deltaX * -ANGULAR_SCALE, up);
|
||||
const float LINEAR_SCALE = 0.01f;
|
||||
setPosition(position + rotation * vector + up * (deltaY * LINEAR_SCALE * _scale));
|
||||
setOrientation(rotation * orientation);
|
||||
glm::quat rotation = glm::angleAxis(deltaX * -ANGULAR_SCALE, orientation * IDENTITY_UP);
|
||||
setPosition(position + rotation * (getPosition() - position));
|
||||
orientation = rotation * orientation;
|
||||
setOrientation(orientation);
|
||||
|
||||
// then vertically
|
||||
float oldMousePitch = _head.getMousePitch();
|
||||
_head.setMousePitch(oldMousePitch + deltaY * ANGULAR_SCALE);
|
||||
rotation = glm::angleAxis(_head.getMousePitch() - oldMousePitch, orientation * IDENTITY_RIGHT);
|
||||
setPosition(position + rotation * (getPosition() - position));
|
||||
}
|
||||
|
||||
float MyAvatar::getAbsoluteHeadYaw() const {
|
||||
|
|
Loading…
Reference in a new issue