mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-07 08:53:40 +02:00
Abandon exponential acceleration and use constant acceleration. Hook up turn->sit transitions.
This commit is contained in:
parent
11e1c4e6fe
commit
37010648be
8 changed files with 220 additions and 88 deletions
Binary file not shown.
Binary file not shown.
BIN
interface/resources/avatar/animations/sitting_turn_left.fbx
Normal file
BIN
interface/resources/avatar/animations/sitting_turn_left.fbx
Normal file
Binary file not shown.
BIN
interface/resources/avatar/animations/sitting_turn_right.fbx
Normal file
BIN
interface/resources/avatar/animations/sitting_turn_right.fbx
Normal file
Binary file not shown.
|
@ -684,139 +684,287 @@
|
|||
"children": [
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"children": [
|
||||
],
|
||||
"data": {
|
||||
"endFrame": 800,
|
||||
"loopFlag": true,
|
||||
"startFrame": 0,
|
||||
"timeScale": 1,
|
||||
"url": "qrc:///avatar/animations/sitting_idle.fbx"
|
||||
},
|
||||
"id": "seatedIdle01",
|
||||
"type": "clip"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
],
|
||||
"data": {
|
||||
"endFrame": 800,
|
||||
"loopFlag": true,
|
||||
"startFrame": 1,
|
||||
"timeScale": 1,
|
||||
"url": "qrc:///avatar/animations/sitting_idle02.fbx"
|
||||
},
|
||||
"id": "seatedIdle02",
|
||||
"type": "clip"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
],
|
||||
"data": {
|
||||
"endFrame": 800,
|
||||
"loopFlag": true,
|
||||
"startFrame": 0,
|
||||
"timeScale": 1,
|
||||
"url": "qrc:///avatar/animations/sitting_idle03.fbx"
|
||||
},
|
||||
"id": "seatedIdle03",
|
||||
"type": "clip"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
],
|
||||
"data": {
|
||||
"endFrame": 800,
|
||||
"loopFlag": true,
|
||||
"startFrame": 1,
|
||||
"timeScale": 1,
|
||||
"url": "qrc:///avatar/animations/sitting_idle04.fbx"
|
||||
},
|
||||
"id": "seatedIdle04",
|
||||
"type": "clip"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
],
|
||||
"data": {
|
||||
"endFrame": 332,
|
||||
"loopFlag": true,
|
||||
"startFrame": 1,
|
||||
"timeScale": 1,
|
||||
"url": "qrc:///avatar/animations/sitting_idle05.fbx"
|
||||
},
|
||||
"id": "seatedIdle05",
|
||||
"type": "clip"
|
||||
}
|
||||
],
|
||||
"data": {
|
||||
"endFrame": 800,
|
||||
"loopFlag": true,
|
||||
"startFrame": 0,
|
||||
"currentState": "seatedIdle01",
|
||||
"endFrame": 30,
|
||||
"randomSwitchTimeMax": 40,
|
||||
"randomSwitchTimeMin": 10,
|
||||
"startFrame": 10,
|
||||
"states": [
|
||||
{
|
||||
"easingType": "easeInOutQuad",
|
||||
"id": "seatedIdle01",
|
||||
"interpDuration": 30,
|
||||
"interpTarget": 30,
|
||||
"interpType": "evaluateBoth",
|
||||
"priority": 1,
|
||||
"resume": true,
|
||||
"transitions": [
|
||||
]
|
||||
},
|
||||
{
|
||||
"easingType": "easeInOutQuad",
|
||||
"id": "seatedIdle02",
|
||||
"interpDuration": 30,
|
||||
"interpTarget": 30,
|
||||
"interpType": "evaluateBoth",
|
||||
"priority": 1,
|
||||
"resume": true,
|
||||
"transitions": [
|
||||
]
|
||||
},
|
||||
{
|
||||
"easingType": "easeInOutQuad",
|
||||
"id": "seatedIdle03",
|
||||
"interpDuration": 30,
|
||||
"interpTarget": 30,
|
||||
"interpType": "evaluateBoth",
|
||||
"priority": 1,
|
||||
"resume": true,
|
||||
"transitions": [
|
||||
]
|
||||
},
|
||||
{
|
||||
"easingType": "easeInOutQuad",
|
||||
"id": "seatedIdle04",
|
||||
"interpDuration": 30,
|
||||
"interpTarget": 30,
|
||||
"interpType": "evaluateBoth",
|
||||
"priority": 1,
|
||||
"resume": true,
|
||||
"transitions": [
|
||||
]
|
||||
},
|
||||
{
|
||||
"easingType": "easeInOutQuad",
|
||||
"id": "seatedIdle05",
|
||||
"interpDuration": 30,
|
||||
"interpTarget": 30,
|
||||
"interpType": "evaluateBoth",
|
||||
"priority": 1,
|
||||
"resume": true,
|
||||
"transitions": [
|
||||
]
|
||||
}
|
||||
],
|
||||
"timeScale": 1,
|
||||
"url": "qrc:///avatar/animations/sitting_idle.fbx"
|
||||
"triggerRandomSwitch": "seatedIdleSwitch",
|
||||
"triggerTimeMax": 10
|
||||
},
|
||||
"id": "seatedIdle01",
|
||||
"type": "clip"
|
||||
"id": "masterSeatedIdleRand",
|
||||
"type": "randomSwitchStateMachine"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
],
|
||||
"data": {
|
||||
"endFrame": 800,
|
||||
"endFrame": 400,
|
||||
"loopFlag": true,
|
||||
"startFrame": 1,
|
||||
"timeScale": 1,
|
||||
"url": "qrc:///avatar/animations/sitting_idle02.fbx"
|
||||
"url": "qrc:///avatar/animations/sitting_turn_left.fbx"
|
||||
},
|
||||
"id": "seatedIdle02",
|
||||
"id": "seatedTurnLeft",
|
||||
"type": "clip"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
],
|
||||
"data": {
|
||||
"endFrame": 800,
|
||||
"loopFlag": true,
|
||||
"startFrame": 0,
|
||||
"timeScale": 1,
|
||||
"url": "qrc:///avatar/animations/sitting_idle03.fbx"
|
||||
},
|
||||
"id": "seatedIdle03",
|
||||
"type": "clip"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
],
|
||||
"data": {
|
||||
"endFrame": 800,
|
||||
"endFrame": 400,
|
||||
"loopFlag": true,
|
||||
"startFrame": 1,
|
||||
"timeScale": 1,
|
||||
"url": "qrc:///avatar/animations/sitting_idle04.fbx"
|
||||
"url": "qrc:///avatar/animations/sitting_turn_right.fbx"
|
||||
},
|
||||
"id": "seatedIdle04",
|
||||
"id": "seatedTurnRight",
|
||||
"type": "clip"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
],
|
||||
"data": {
|
||||
"endFrame": 332,
|
||||
"loopFlag": true,
|
||||
"endFrame": 45,
|
||||
"loopFlag": false,
|
||||
"startFrame": 1,
|
||||
"timeScale": 1,
|
||||
"url": "qrc:///avatar/animations/sitting_idle05.fbx"
|
||||
"url": "qrc:///avatar/animations/settle_sitturnright_to_sitidle.fbx"
|
||||
},
|
||||
"id": "seatedIdle05",
|
||||
"id": "seatedTurnRight_to_Idle",
|
||||
"type": "clip"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
],
|
||||
"data": {
|
||||
"endFrame": 45,
|
||||
"loopFlag": false,
|
||||
"startFrame": 1,
|
||||
"timeScale": 1,
|
||||
"url": "qrc:///avatar/animations/settle_sitturnright_to_sitidle.fbx"
|
||||
},
|
||||
"id": "seatedTurnLeft_to_Idle",
|
||||
"type": "clip"
|
||||
}
|
||||
],
|
||||
"data": {
|
||||
"currentState": "seatedIdle01",
|
||||
"endFrame": 30,
|
||||
"randomSwitchTimeMax": 40,
|
||||
"randomSwitchTimeMin": 10,
|
||||
"startFrame": 10,
|
||||
"currentState": "masterSeatedIdleRand",
|
||||
"states": [
|
||||
{
|
||||
"easingType": "easeInOutQuad",
|
||||
"id": "seatedIdle01",
|
||||
"interpDuration": 30,
|
||||
"interpTarget": 30,
|
||||
"interpType": "evaluateBoth",
|
||||
"priority": 1,
|
||||
"resume": true,
|
||||
"id": "masterSeatedIdleRand",
|
||||
"interpDuration": 15,
|
||||
"interpTarget": 15,
|
||||
"interpType": "snapshotPrev",
|
||||
"transitions": [
|
||||
{
|
||||
"state": "seatedTurnLeft",
|
||||
"var": "isSeatedTurningLeft"
|
||||
},
|
||||
{
|
||||
"state": "seatedTurnRight",
|
||||
"var": "isSeatedTurningRight"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"easingType": "easeInOutQuad",
|
||||
"id": "seatedIdle02",
|
||||
"interpDuration": 30,
|
||||
"interpTarget": 30,
|
||||
"id": "seatedTurnLeft",
|
||||
"interpDuration": 25,
|
||||
"interpTarget": 25,
|
||||
"interpType": "evaluateBoth",
|
||||
"priority": 1,
|
||||
"resume": true,
|
||||
"transitions": [
|
||||
{
|
||||
"state": "seatedTurnLeft_to_Idle",
|
||||
"var": "isSeatedNotTurning"
|
||||
},
|
||||
{
|
||||
"state": "seatedTurnRight",
|
||||
"var": "isSeatedTurningRight"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"easingType": "easeInOutQuad",
|
||||
"id": "seatedIdle03",
|
||||
"interpDuration": 30,
|
||||
"interpTarget": 30,
|
||||
"id": "seatedTurnRight",
|
||||
"interpDuration": 25,
|
||||
"interpTarget": 25,
|
||||
"interpType": "evaluateBoth",
|
||||
"priority": 1,
|
||||
"resume": true,
|
||||
"transitions": [
|
||||
{
|
||||
"state": "seatedTurnLeft",
|
||||
"var": "isSeatedTurningLeft"
|
||||
},
|
||||
{
|
||||
"state": "seatedTurnRight_to_Idle",
|
||||
"var": "isSeatedNotTurning"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"easingType": "easeInOutQuad",
|
||||
"id": "seatedIdle04",
|
||||
"interpDuration": 30,
|
||||
"interpTarget": 30,
|
||||
"id": "seatedTurnRight_to_Idle",
|
||||
"interpDuration": 15,
|
||||
"interpTarget": 15,
|
||||
"interpType": "evaluateBoth",
|
||||
"priority": 1,
|
||||
"resume": true,
|
||||
"transitions": [
|
||||
{
|
||||
"state": "seatedTurnLeft",
|
||||
"var": "isSeatedTurningLeft"
|
||||
},
|
||||
{
|
||||
"state": "masterSeatedIdleRand",
|
||||
"var": "seatedTurnRight_to_IdleOnDone"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"easingType": "easeInOutQuad",
|
||||
"id": "seatedIdle05",
|
||||
"interpDuration": 30,
|
||||
"interpTarget": 30,
|
||||
"id": "seatedTurnLeft_to_Idle",
|
||||
"interpDuration": 15,
|
||||
"interpTarget": 15,
|
||||
"interpType": "evaluateBoth",
|
||||
"priority": 1,
|
||||
"resume": true,
|
||||
"transitions": [
|
||||
{
|
||||
"state": "seatedTurnRight",
|
||||
"var": "isSeatedTurningRight"
|
||||
},
|
||||
{
|
||||
"state": "masterSeatedIdleRand",
|
||||
"var": "seatedTurnLeft_to_IdleOnDone"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"timeScale": 1,
|
||||
"triggerRandomSwitch": "seatedIdleSwitch",
|
||||
"triggerTimeMax": 10
|
||||
]
|
||||
},
|
||||
"id": "masterSeatedIdle",
|
||||
"type": "randomSwitchStateMachine"
|
||||
"type": "stateMachine"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
|
|
|
@ -3514,16 +3514,11 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
|||
setWorldOrientation(glm::slerp(getWorldOrientation(), faceRotation, blend));
|
||||
} else if (isRotatingWhileSeated) {
|
||||
float direction = -getDriveKey(TRANSLATE_X);
|
||||
//float seatedTargetSpeed = direction * _yawSpeed; //deg/sec
|
||||
float seatedTargetSpeed = direction * _yawSpeed * deltaTime; //deg/renderframe
|
||||
|
||||
//if (_seatedBodyYawDelta / seatedTargetSpeed < 0.0f) {
|
||||
// //reverse direction, start acceleration timer again
|
||||
// _seatedInterpTime = 0.0f;
|
||||
//}
|
||||
const float SEATED_ROTATION_ACCEL_SCALE = 3.0;
|
||||
|
||||
const float SEATED_ROTATION_RAMP_TIMESCALE = 2.5;
|
||||
float blend = deltaTime * SEATED_ROTATION_RAMP_TIMESCALE;
|
||||
float blend = deltaTime * SEATED_ROTATION_ACCEL_SCALE;
|
||||
if (blend > 1.0f) {
|
||||
blend = 1.0f;
|
||||
}
|
||||
|
@ -3533,22 +3528,15 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
|||
if (fabsf(_seatedBodyYawDelta) >= fabsf(seatedTargetSpeed)) {
|
||||
_seatedBodyYawDelta = seatedTargetSpeed;
|
||||
} else {
|
||||
//_seatedInterpTime += blend;
|
||||
//_seatedBodyYawDelta = _seatedInterpTime * _seatedInterpTime * direction / blend;
|
||||
_seatedBodyYawDelta += blend * direction;
|
||||
}
|
||||
} else {
|
||||
_seatedInterpTime = blend;
|
||||
_seatedBodyYawDelta = blend * direction;
|
||||
}
|
||||
|
||||
float totalSeatedBodyYaw = _seatedBodyYawDelta * deltaTime;
|
||||
//setWorldOrientation(getWorldOrientation() * glm::quat(glm::radians(glm::vec3(0.0f, totalSeatedBodyYaw, 0.0f))));
|
||||
setWorldOrientation(getWorldOrientation() * glm::quat(glm::radians(glm::vec3(0.0f, _seatedBodyYawDelta, 0.0f))));
|
||||
|
||||
} else if (_seatedBodyYawDelta != 0.0f) {
|
||||
//qDebug() << "start _seatedBodyYawDelta: " << _seatedBodyYawDelta;
|
||||
// decelerate
|
||||
const float ROTATION_DECAY_TIMESCALE = 0.25f;
|
||||
float attenuation = 1.0f - deltaTime / ROTATION_DECAY_TIMESCALE;
|
||||
if (attenuation < 0.0f) {
|
||||
|
@ -3561,12 +3549,9 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
|||
_seatedBodyYawDelta = 0.0f;
|
||||
}
|
||||
|
||||
//float totalSeatedBodyYaw = _seatedBodyYawDelta * deltaTime;
|
||||
//setWorldOrientation(getWorldOrientation() * glm::quat(glm::radians(glm::vec3(0.0f, totalSeatedBodyYaw, 0.0f))));
|
||||
setWorldOrientation(getWorldOrientation() * glm::quat(glm::radians(glm::vec3(0.0f, _seatedBodyYawDelta, 0.0f))));
|
||||
} else {
|
||||
_seatedBodyYawDelta = 0.0f;
|
||||
_seatedInterpTime = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3628,10 +3613,10 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
|||
const float TRIGGER_REORIENT_ANGLE = 135.0f;
|
||||
const float FIRST_PERSON_TRIGGER_REORIENT_ANGLE = 65.0f;
|
||||
glm::vec3 ajustedYawVector = cameraYawVector;
|
||||
float triggerAngle = glm::sin(glm::radians(90.0f - TRIGGER_REORIENT_ANGLE));
|
||||
float triggerAngle = glm::cos(glm::radians(TRIGGER_REORIENT_ANGLE));
|
||||
float limitAngle = triggerAngle;
|
||||
if (mode == CAMERA_MODE_FIRST_PERSON_LOOK_AT) {
|
||||
limitAngle = glm::sin(glm::radians(90.0f - FIRST_PERSON_TRIGGER_REORIENT_ANGLE));
|
||||
limitAngle = glm::cos(glm::radians(FIRST_PERSON_TRIGGER_REORIENT_ANGLE));
|
||||
triggerAngle = limitAngle;
|
||||
}
|
||||
float reorientAngle = mode == CAMERA_MODE_FIRST_PERSON_LOOK_AT ? FIRST_PERSON_REORIENT_ANGLE : DEFAULT_REORIENT_ANGLE;
|
||||
|
|
|
@ -1423,12 +1423,12 @@ void Rig::computeMotionAnimationState(float deltaTime, const glm::vec3& worldPos
|
|||
_animVars.set("isSeatedTurningRight", false);
|
||||
_animVars.set("isSeatedTurningLeft", false);
|
||||
_animVars.set("isSeatedNotTurning", true);
|
||||
} else if (turningSpeed > 0.1f) {
|
||||
} else if (_previousControllerParameters.inputX > 0.0f) {
|
||||
// seated turning right
|
||||
_animVars.set("isSeatedTurningRight", true);
|
||||
_animVars.set("isSeatedTurningLeft", false);
|
||||
_animVars.set("isSeatedNotTurning", false);
|
||||
} else if (turningSpeed < -0.1f) {
|
||||
} else {
|
||||
// seated turning left
|
||||
_animVars.set("isSeatedTurningRight", false);
|
||||
_animVars.set("isSeatedTurningLeft", true);
|
||||
|
|
|
@ -662,8 +662,7 @@ protected:
|
|||
std::vector<std::shared_ptr<Model>> _attachmentsToDelete;
|
||||
|
||||
float _bodyYawDelta { 0.0f }; // degrees/sec
|
||||
float _seatedBodyYawDelta{ 0.0f }; //degrees/sec
|
||||
float _seatedInterpTime{ 0.0f }; //used to transition rot while seated.
|
||||
float _seatedBodyYawDelta{ 0.0f }; // degrees/renderframe
|
||||
|
||||
// These position histories and derivatives are in the world-frame.
|
||||
// The derivatives are the MEASURED results of all external and internal forces
|
||||
|
|
Loading…
Reference in a new issue