mirror of
https://github.com/lubosz/overte.git
synced 2025-04-26 21:35:45 +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;
|
||||
|
||||
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;
|
||||
btQuaternion angularDisplacement = btQuaternion(deltaRot.getAxis(), angularSpeed * dt);
|
||||
btQuaternion endRot = angularDisplacement * startRot;
|
||||
|
|
Loading…
Reference in a new issue