Merge pull request #9150 from hyperlogic/bug-fix/driving-while-flying-in-hmd

Fix for driving/turning while flying in HMD mode
This commit is contained in:
Andrew Meadows 2016-12-05 13:46:29 -08:00 committed by GitHub
commit a69d77ffbe
2 changed files with 7 additions and 2 deletions

View file

@ -467,6 +467,8 @@ void MyAvatar::simulate(float deltaTime) {
if (_characterController.getState() != CharacterController::State::Hover) {
updateSensorToWorldMatrix(_enableVerticalComfortMode ? SensorToWorldUpdateMode::VerticalComfort : SensorToWorldUpdateMode::Vertical);
} else {
updateSensorToWorldMatrix(SensorToWorldUpdateMode::None);
}
{
@ -616,6 +618,8 @@ void MyAvatar::updateSensorToWorldMatrix(SensorToWorldUpdateMode mode) {
} else if (mode == SensorToWorldUpdateMode::Vertical) {
setSensorToWorldMatrix(sensorToWorldMat);
}
} else if (mode == SensorToWorldUpdateMode::None) {
setSensorToWorldMatrix(_sensorToWorldMatrix);
}
}
@ -1897,7 +1901,7 @@ void MyAvatar::applyVelocityToSensorToWorldMatrix(const glm::vec3& velocity, flo
// update the position column of matrix
glm::mat4 newSensorToWorldMatrix = _sensorToWorldMatrix;
newSensorToWorldMatrix[3] = glm::vec4(position, 1.0f);
setSensorToWorldMatrix(newSensorToWorldMatrix);
_sensorToWorldMatrix = newSensorToWorldMatrix;
}
}

View file

@ -192,7 +192,8 @@ public:
enum class SensorToWorldUpdateMode {
Full = 0,
Vertical,
VerticalComfort
VerticalComfort,
None
};
void updateSensorToWorldMatrix(SensorToWorldUpdateMode mode = SensorToWorldUpdateMode::Full);