Mostly add CPhysicsActor::GetRotateToORAngularMomentumWR

Former-commit-id: fe02b80545
This commit is contained in:
Henrique Gemignani Passos Lima
2022-11-04 12:50:34 +02:00
parent 7f947e6442
commit c109339372
4 changed files with 14 additions and 4 deletions

View File

@@ -229,7 +229,13 @@ CVector3f CPhysicsActor::GetMoveToORImpulseWR(const CVector3f& trans, float d) c
return (GetMass() * impulse) * (1.f / d);
}
CAxisAngle CPhysicsActor::GetRotateToORAngularMomentumWR(const CQuaternion& q, float d) const {
// TODO
return CAxisAngle();
CVector3f CPhysicsActor::GetRotateToORAngularMomentumWR(const CQuaternion& q, float d) const {
if (q.GetW() > 0.99999976f) {
return CVector3f::Zero();
} else {
const CVector3f rotated = GetTransform().Rotate(q.GetImaginary());
float ac = acos(q.GetW());
return rotated.AsNormalized() * ((ac * 2.0f) * (1.0f / d)) * xf0_inertiaTensor;
}
}