mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 13:28:09 +02:00
Bug fix for follow rotation of CharacterController
This commit is contained in:
parent
8e56404c40
commit
cd6d2173cc
1 changed files with 5 additions and 1 deletions
|
@ -265,7 +265,11 @@ void CharacterController::playerStep(btCollisionWorld* collisionWorld, btScalar
|
||||||
btVector3 endPos = startPos + linearDisplacement;
|
btVector3 endPos = startPos + linearDisplacement;
|
||||||
|
|
||||||
btQuaternion startRot = bodyTransform.getRotation();
|
btQuaternion startRot = bodyTransform.getRotation();
|
||||||
btQuaternion deltaRot = _followDesiredBodyTransform.getRotation() * startRot.inverse();
|
btQuaternion desiredRot = _followDesiredBodyTransform.getRotation();
|
||||||
|
if (desiredRot.dot(startRot) < 0.0f) {
|
||||||
|
desiredRot = -desiredRot;
|
||||||
|
}
|
||||||
|
btQuaternion deltaRot = desiredRot * startRot.inverse();
|
||||||
float angularSpeed = deltaRot.getAngle() / _followTimeRemaining;
|
float angularSpeed = deltaRot.getAngle() / _followTimeRemaining;
|
||||||
btQuaternion angularDisplacement = btQuaternion(deltaRot.getAxis(), angularSpeed * dt);
|
btQuaternion angularDisplacement = btQuaternion(deltaRot.getAxis(), angularSpeed * dt);
|
||||||
btQuaternion endRot = angularDisplacement * startRot;
|
btQuaternion endRot = angularDisplacement * startRot;
|
||||||
|
|
Loading…
Reference in a new issue