|
|
@ -124,6 +124,10 @@ public partial class AnimationController : Node3D |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float _yawFactorLowerBody = 0.15f; |
|
|
|
|
|
|
|
float _yawFactorUpperBody = 0.20f; |
|
|
|
|
|
|
|
float _yawFactorNeck = 0.45f; |
|
|
|
void HandleWalkingAnimation(double delta) |
|
|
|
void HandleWalkingAnimation(double delta) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const float ForwardAngle = 95.0f; |
|
|
|
const float ForwardAngle = 95.0f; |
|
|
@ -146,9 +150,19 @@ public partial class AnimationController : Node3D |
|
|
|
var prevWalkSpeed = (float)_animTree.Get(WalkSpeedParam); |
|
|
|
var prevWalkSpeed = (float)_animTree.Get(WalkSpeedParam); |
|
|
|
_animTree.Set(WalkSpeedParam, Lerp(prevWalkSpeed, walkSpeed, 10 * (float)delta)); |
|
|
|
_animTree.Set(WalkSpeedParam, Lerp(prevWalkSpeed, walkSpeed, 10 * (float)delta)); |
|
|
|
|
|
|
|
|
|
|
|
const float YawFactorLowerBody = 0.15f; |
|
|
|
const float EmptyYawFactorLowerBody = 0.15f; |
|
|
|
const float YawFactorUpperBody = 0.20f; |
|
|
|
const float EmptyYawFactorUpperBody = 0.20f; |
|
|
|
const float YawFactorNeck = 0.45f; |
|
|
|
const float EmptyYawFactorNeck = 0.45f; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const float HoldingYawFactorLowerBody = 0.35f; |
|
|
|
|
|
|
|
const float HoldingYawFactorUpperBody = 0.25f; |
|
|
|
|
|
|
|
const float HoldingYawFactorNeck = 0.10f; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: This should probably be using delta somehow, but I'm not sure how. |
|
|
|
|
|
|
|
var held = _player.Pickup.HasItemsHeld; |
|
|
|
|
|
|
|
_yawFactorLowerBody = (_yawFactorLowerBody + (held ? HoldingYawFactorLowerBody : EmptyYawFactorLowerBody)) / 2; |
|
|
|
|
|
|
|
_yawFactorUpperBody = (_yawFactorLowerBody + (held ? HoldingYawFactorUpperBody : EmptyYawFactorUpperBody)) / 2; |
|
|
|
|
|
|
|
_yawFactorNeck = (_yawFactorLowerBody + (held ? HoldingYawFactorNeck : EmptyYawFactorNeck )) / 2; |
|
|
|
|
|
|
|
|
|
|
|
if (movement.IsMoving) { |
|
|
|
if (movement.IsMoving) { |
|
|
|
var targetBodyYaw = localAngle; |
|
|
|
var targetBodyYaw = localAngle; |
|
|
@ -157,10 +171,10 @@ public partial class AnimationController : Node3D |
|
|
|
} else |
|
|
|
} else |
|
|
|
_bodyYaw -= _bodyYaw * (float)delta * 2; |
|
|
|
_bodyYaw -= _bodyYaw * (float)delta * 2; |
|
|
|
|
|
|
|
|
|
|
|
_bones["Root" ].GlobalRotate(Vector3.Up, _bodyYaw * (YawFactorLowerBody + YawFactorUpperBody + YawFactorNeck)); |
|
|
|
_bones["Root" ].GlobalRotate(Vector3.Up, _bodyYaw * (_yawFactorLowerBody + _yawFactorUpperBody + _yawFactorNeck)); |
|
|
|
_bones["LowerBody"].GlobalRotate(Vector3.Up, -_bodyYaw * YawFactorLowerBody); |
|
|
|
_bones["LowerBody"].GlobalRotate(Vector3.Up, -_bodyYaw * _yawFactorLowerBody); |
|
|
|
_bones["UpperBody"].GlobalRotate(Vector3.Up, -_bodyYaw * YawFactorUpperBody); |
|
|
|
_bones["UpperBody"].GlobalRotate(Vector3.Up, -_bodyYaw * _yawFactorUpperBody); |
|
|
|
_bones["Neck" ].GlobalRotate(Vector3.Up, -_bodyYaw * YawFactorNeck); |
|
|
|
_bones["Neck" ].GlobalRotate(Vector3.Up, -_bodyYaw * _yawFactorNeck); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Vector3? _defaultPickupPosition; |
|
|
|
Vector3? _defaultPickupPosition; |
|
|
|