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