void DoPoweredRotationMatching(AnimatedPair pair, BoneProfile boneProfile, float dt) { RagdollBone bone = pair.RagdollBone; Rigidbody rigidbody = bone.Rigidbody; float alpha = boneProfile.rotationAlpha; float dampingRatio = boneProfile.rotationDampingRatio; SetTargetRotation(pair); SetTargetAngularVelocityLocal(bone.Joint, pair.poseAngularVelocity, pair.RagdollBone.StartingJointRotation); bone.Joint.slerpDrive = AnimationMatching.GetRotationMatchingJointDrive(alpha, dampingRatio, rigidbody.mass, dt, boneProfile.maxAngularAcceleration); }
void DoPoweredPositionMatching(AnimatedPair pair, BoneProfile boneProfile, float dt) { float alpha = boneProfile.positionAlpha; float dampingRatio = boneProfile.positionDampingRatio; Rigidbody rigidbody = pair.RagdollBone.Rigidbody; AnimatedPose targetPose = pair.currentPose; Vector3 acceleration = AnimationMatching.GetAccelerationFromPositionSpring(rigidbody.position, targetPose.worldPosition, rigidbody.velocity, pair.poseLinearVelocity, alpha, dampingRatio, rigidbody.mass, dt); LimitAcceleration(ref acceleration, boneProfile.maxLinearAcceleration); rigidbody.AddForce(acceleration, ForceMode.Acceleration); }