Merge pull request #6700 from AndrewMeadows/angular-velocity-is-a-vector

protect against NaN in measure of hydra angularVelocity
This commit is contained in:
Brad Hefta-Gaub 2015-12-18 14:29:23 -08:00
commit bfa0652100

View file

@ -466,9 +466,10 @@ void SixenseManager::InputDevice::handlePoseEvent(float deltaTime, glm::vec3 pos
samples.first.addSample(velocity);
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 speed = glm::angle(deltaRot) / deltaTime;
assert(!glm::isnan(speed));
angularVelocity = speed * axis;
samples.second.addSample(angularVelocity);
angularVelocity = samples.second.average;