mirror of
https://github.com/overte-org/overte.git
synced 2025-08-16 07:32:17 +02:00
Fix for driving/turning while flying in HMD mode
The internal MyAvatar:_sensorToWorldMatrix was being updated properly, however the MyAvatar::_sensorToWorldMatrixCache was not. To fix this I've introduced a new "mode" to updateSensorToWorldMatrix that does not change the sensorToWorldMatrix at all, but properly copies the value to the cache and also updates hand controller poses etc.
This commit is contained in:
parent
6cb85e92b1
commit
a0f93dad2c
2 changed files with 7 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -192,7 +192,8 @@ public:
|
|||
enum class SensorToWorldUpdateMode {
|
||||
Full = 0,
|
||||
Vertical,
|
||||
VerticalComfort
|
||||
VerticalComfort,
|
||||
None
|
||||
};
|
||||
void updateSensorToWorldMatrix(SensorToWorldUpdateMode mode = SensorToWorldUpdateMode::Full);
|
||||
|
||||
|
|
Loading…
Reference in a new issue