mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 07:51:01 +02:00
MyAvatar.addThrust() works again.
This commit is contained in:
parent
99da6c68e3
commit
1f7dc25f12
1 changed files with 7 additions and 2 deletions
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue