MyAvatar.addThrust() works again.

This commit is contained in:
Anthony J. Thibault 2016-09-21 11:48:54 -07:00
parent 99da6c68e3
commit 1f7dc25f12

View file

@ -1336,8 +1336,7 @@ void MyAvatar::updateMotors() {
// legacy support for 'MyAvatar::applyThrust()', which has always been implemented as a // legacy support for 'MyAvatar::applyThrust()', which has always been implemented as a
// short-lived linearAcceleration // short-lived linearAcceleration
_characterController.setLinearAcceleration(_thrust); _characterController.setLinearAcceleration(glm::vec3(0.0f, _thrust.y, 0.0f));
_thrust = Vectors::ZERO;
} }
void MyAvatar::prepareForPhysicsSimulation() { void MyAvatar::prepareForPhysicsSimulation() {
@ -1867,9 +1866,15 @@ void MyAvatar::updatePosition(float deltaTime) {
worldVelocity = motorRotation * _scriptedMotorVelocity; worldVelocity = motorRotation * _scriptedMotorVelocity;
applyVelocityToSensorToWorldMatrix(worldVelocity, deltaTime); applyVelocityToSensorToWorldMatrix(worldVelocity, deltaTime);
} }
// OUTOFBODY_HACK: apply scaling factor to _thrust, to get the same behavior as an periodically applied motor.
const float THRUST_DAMPING_FACTOR = 0.25f;
applyVelocityToSensorToWorldMatrix(THRUST_DAMPING_FACTOR * _thrust, deltaTime);
} }
} }
_thrust = Vectors::ZERO;
// capture the head rotation, in sensor space, when the user first indicates they would like to move/fly. // capture the head rotation, in sensor space, when the user first indicates they would like to move/fly.
if (!_hoverReferenceCameraFacingIsCaptured && (fabs(_driveKeys[TRANSLATE_Z]) > 0.1f || fabs(_driveKeys[TRANSLATE_X]) > 0.1f)) { if (!_hoverReferenceCameraFacingIsCaptured && (fabs(_driveKeys[TRANSLATE_Z]) > 0.1f || fabs(_driveKeys[TRANSLATE_X]) > 0.1f)) {
_hoverReferenceCameraFacingIsCaptured = true; _hoverReferenceCameraFacingIsCaptured = true;