mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
Merge pull request #6700 from AndrewMeadows/angular-velocity-is-a-vector
protect against NaN in measure of hydra angularVelocity
This commit is contained in:
commit
bfa0652100
1 changed files with 2 additions and 1 deletions
|
@ -466,9 +466,10 @@ void SixenseManager::InputDevice::handlePoseEvent(float deltaTime, glm::vec3 pos
|
||||||
samples.first.addSample(velocity);
|
samples.first.addSample(velocity);
|
||||||
velocity = samples.first.average;
|
velocity = samples.first.average;
|
||||||
|
|
||||||
auto deltaRot = rotation * glm::conjugate(prevPose.getRotation());
|
auto deltaRot = glm::normalize(rotation * glm::conjugate(prevPose.getRotation()));
|
||||||
auto axis = glm::axis(deltaRot);
|
auto axis = glm::axis(deltaRot);
|
||||||
auto speed = glm::angle(deltaRot) / deltaTime;
|
auto speed = glm::angle(deltaRot) / deltaTime;
|
||||||
|
assert(!glm::isnan(speed));
|
||||||
angularVelocity = speed * axis;
|
angularVelocity = speed * axis;
|
||||||
samples.second.addSample(angularVelocity);
|
samples.second.addSample(angularVelocity);
|
||||||
angularVelocity = samples.second.average;
|
angularVelocity = samples.second.average;
|
||||||
|
|
Loading…
Reference in a new issue