Compute angular acceleration from torque in 3D I am coding a simulation in which a force is applied to the corner of a cube
Here is a picture to understand the problem better, the force is represented by the segment IF
I first developed the program to work in 2d, the angular acceleration then was easy to compute with the equation linking torque, moment of inertia and acceleration : $τ = I*α$
In 2D, it is simple to know $I$ and $τ$ as they are both around the z axis only. In 3d though, $I$ and $τ$ have to be calculated for the three axes and that's where I can't make it work.
The cube size is known a $a$ and may be oriented with euler angles, or maybe a quaternion, either way how could you compute the torque generated by $\vec{IF}$ nor the moment of inertia of the rotated cube ?
 A: The equations of motion for rotation about the center of mass are
$$ \boldsymbol{\tau} = \mathbf{I}\,\boldsymbol{\alpha} + \boldsymbol{\omega} \times \mathbf{I} \boldsymbol{\omega} \tag{1} $$
where $\boldsymbol{\tau}$ is the net torque about the center of mass, $\boldsymbol{\omega}$ and  $\boldsymbol{\alpha}$ are the rotational velocities and accelerations, and $\mathbf{I}$ is the mass moment of inertia tensor about the center of mass, and along the world coordinates.
The derivation of the net torque from individual forces and torques applied to the body is
$$ \boldsymbol{\tau} = \sum_i ( \boldsymbol{\tau}_i + \boldsymbol{r}_i \times \boldsymbol{F}_i ) \tag{2} $$
where $\boldsymbol{r}_i$ is the location of force $\boldsymbol{F}_i$ relative to the center of mass, and $\boldsymbol{\tau}_i$ is any torque applied to the body (if any).
The difficult part is to find the mass moment of inertia matrix $\mathbf{I}$ for each time frame.
However the orientation is specified, it must be brought into the form of a 3×3 rotation matrix $\mathrm{R}$ which rotated vectors from the body frame to the world frame.
The MMOI tensor of a body in body frame is $\mathbf{I}_{\rm body}$ and does not change with time.
In world frame the MMOI tensor is evaluated with the following operation
$$ \mathbf{I} = \mathrm{R}\, \mathbf{I}_{\rm body} \mathrm{R}^\top \tag{3} $$
A couple of quick thoughts at this point. To find the angular acceleration you need both the MMOI tensor, and its inverse. Solve (1) to get
$$ \boldsymbol{\alpha} = \mathbf{I}^{-1} \left( \boldsymbol{\tau} - \boldsymbol{\omega} \times \mathbf{I} \boldsymbol{\omega} \right) \tag{4} $$
There are several reasons why you don't want to keep track of the rotation matrix, but instead derive it on each frame from either 3 euler angles, or a quaternion. In my option, going the quaternion route is easier because finding the jacobian matrix that convers euler angle speeds into rotational velocity is rather complex, and then you have to take the time derivative of the jacobian to work with rotational accelerations.
