set _hmdFollowVelocity to zero when done following

This commit is contained in:
U-GAPOS\andrew 2015-11-04 10:23:55 -08:00
parent 439bdbc0e4
commit 9de5721a48

View file

@ -1299,11 +1299,11 @@ void MyAvatar::prepareForPhysicsSimulation() {
_characterController.setAvatarPositionAndOrientation(getPosition(), getOrientation()); _characterController.setAvatarPositionAndOrientation(getPosition(), getOrientation());
if (qApp->isHMDMode()) { if (qApp->isHMDMode()) {
updateHMDFollowVelocity(); updateHMDFollowVelocity();
_characterController.setHMDVelocity(_hmdFollowVelocity); } else if (_isFollowingHMD) {
} else {
_characterController.setHMDVelocity(Vectors::ZERO);
_isFollowingHMD = false; _isFollowingHMD = false;
_hmdFollowVelocity = Vectors::ZERO;
} }
_characterController.setHMDVelocity(_hmdFollowVelocity);
} }
void MyAvatar::harvestResultsFromPhysicsSimulation() { void MyAvatar::harvestResultsFromPhysicsSimulation() {
@ -1339,6 +1339,7 @@ void MyAvatar::adjustSensorTransform(glm::vec3 hmdShift) {
// the "adjustment" is more or less complete so stop following // the "adjustment" is more or less complete so stop following
_isFollowingHMD = false; _isFollowingHMD = false;
_hmdFollowSpeed = 0.0f; _hmdFollowSpeed = 0.0f;
_hmdFollowVelocity = Vectors::ZERO;
// and slam the body's transform anyway to eliminate any slight errors // and slam the body's transform anyway to eliminate any slight errors
glm::vec3 finalBodyPosition = extractTranslation(worldBodyMatrix); glm::vec3 finalBodyPosition = extractTranslation(worldBodyMatrix);
nextAttitude(finalBodyPosition, finalBodyRotation); nextAttitude(finalBodyPosition, finalBodyRotation);