mirror of
https://github.com/overte-org/overte.git
synced 2025-04-16 22:06:18 +02:00
Pretty good exponential acceleration, need to simplify
This commit is contained in:
parent
995f5f92cd
commit
9d86e49a0b
1 changed files with 2 additions and 25 deletions
|
@ -3516,7 +3516,7 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
|||
float direction = -getDriveKey(TRANSLATE_X);
|
||||
float seatedTargetSpeed = direction * _yawSpeed * deltaTime;
|
||||
|
||||
const float SEATED_ROTATION_RAMP_TIMESCALE = 1.0; //used as divisor
|
||||
const float SEATED_ROTATION_RAMP_TIMESCALE = 0.25; //used as divisor
|
||||
float blend = deltaTime / SEATED_ROTATION_RAMP_TIMESCALE;
|
||||
if (blend > 1.0f) {
|
||||
blend = 1.0f;
|
||||
|
@ -3525,7 +3525,7 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
|||
/////// ease in
|
||||
//_seatedBodyYawDelta = (1.0f - blend) * _seatedBodyYawDelta + blend * seatedTargetSpeed;
|
||||
|
||||
/////// ease out WIP
|
||||
/////// ease out
|
||||
|
||||
if (fabsf(_seatedBodyYawDelta) > 0.0f) {
|
||||
//we are rotating
|
||||
|
@ -3542,37 +3542,14 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
|||
_seatedBodyYawDelta = blend * direction;
|
||||
}
|
||||
|
||||
//////// linear
|
||||
//if (_seatedBodyYawDelta < seatedTargetSpeed) {
|
||||
// _seatedBodyYawDelta += blend;
|
||||
//}
|
||||
|
||||
setWorldOrientation(getWorldOrientation() * glm::quat(glm::radians(glm::vec3(0.0f, _seatedBodyYawDelta, 0.0f))));
|
||||
|
||||
qDebug() << "_seatedBodyYawDelta: " << _seatedBodyYawDelta;
|
||||
|
||||
//original
|
||||
//float rotatingWhileSeatedYaw = -getDriveKey(TRANSLATE_X) * _yawSpeed * deltaTime;
|
||||
//setWorldOrientation(getWorldOrientation() * glm::quat(glm::radians(glm::vec3(0.0f, rotatingWhileSeatedYaw, 0.0f))));
|
||||
|
||||
//qDebug() << "_seatedBodyYawDelta: " << rotatingWhileSeatedYaw;
|
||||
} else if (_characterController.getSeated() && _seatedBodyYawDelta > 0.0f) {
|
||||
// attenuate body rotation speed
|
||||
const float SEATED_ROTATION_DECAY_TIMESCALE = 0.05f;
|
||||
float attenuation = 1.0f - deltaTime / SEATED_ROTATION_DECAY_TIMESCALE;
|
||||
if (attenuation < 0.0f) {
|
||||
attenuation = 0.0f;
|
||||
}
|
||||
_seatedBodyYawDelta *= attenuation;
|
||||
|
||||
float MINIMUM_ROTATION_RATE = 2.0f;
|
||||
if (fabsf(_seatedBodyYawDelta) < MINIMUM_ROTATION_RATE) {
|
||||
_seatedBodyYawDelta = 0.0f;
|
||||
}
|
||||
|
||||
setWorldOrientation(getWorldOrientation() * glm::quat(glm::radians(glm::vec3(0.0f, _seatedBodyYawDelta, 0.0f))));
|
||||
|
||||
qDebug() << "attenuated _seatedBodyYawDelta: " << _seatedBodyYawDelta;
|
||||
} else {
|
||||
_seatedBodyYawDelta = 0.0f;
|
||||
_seatedInterpTime = 0.0f;
|
||||
|
|
Loading…
Reference in a new issue