计算刚体惯性张量世界坐标

问题描述 投票:2回答:1

我正在尝试使用DirectX绘制对象及其数学库以利用SIMD计算(XMMATRIX和XMVECTOR类)来实现小型刚体物理仿真。

我的问题是关于[[惯性张量,我知道使用其逆数可以像这样计算角加速度:

AngAcc = Inverse(I) * torque
并且局部空间中的惯性张量是恒定的,因此我将其逆与其他成员一起存储在我的RigidBody类中:

//'W' suffix means 'world space' //'L' suffix means 'local space' XMFLOAT3 m_positionW; //rigid body position XMFLOAT4 m_orientationW; //angular orientation XMFLOAT3 m_velocityW; //linear velocity XMFLOAT3 m_rotationW; //angular velocity (rotation) XMFLOAT3X3 m_inverseInertiaTensorL; //inverse of the body inertia tensor in local space (constant) XMFLOAT4X4 m_worldTransform; //transform matrix for converting body space into world space XMFLOAT3X3 m_inverseInertiaTensorW; //inverse of the body inertia tensor in world space (change every frame)

现在,在每一帧上,

我必须计算世界坐标中的惯性张量的倒数

...在这一点上,我有点困惑...我该怎么做?

    我必须将m_inverseInertiaTensorL乘以m_worldTransform?如果是,怎么办?第一个是XMFLOAT3X3,第二个是XMFLOAT4X4 ...
  1. 我必须使用方向吗?在某个地方,我读到类似以下内容:“ inverseWorldInertiaTensor = rot * inverseBodyInertiaTensor * rot.transpose()”,我认为'rot'是这样的矩阵:]

    XMMATRIX旋转= XMMatrixRotationQuaternion(orientationW);

  2. 我很困惑...有人可以帮助我吗?

我正在尝试使用DirectX绘制对象及其数学库以利用SIMD计算(XMMATRIX和XMVECTOR类)来实现小型刚体物理仿真。我的问题...

c++ directx game-physics rigid-bodies
1个回答
0
投票
我发现

通过m_worldTransform乘以m_inverseInertiaTensorL

© www.soinside.com 2019 - 2024. All rights reserved.