I've been developing simple 3D impulse-based physics engine.
I calculate impulse as follows:
$$j_r = \frac{-1(1+e)v_r\cdot\hat n}
{m_1^{-1}+\bbox[yellow,5px,border:2px solid red]{m_2^{-1}}+(I_1^{-1}(r_1\times\hat n)\times r_1+
\bbox[yellow,5px,border:2px solid red]{I_2^{-1}(r_2\times \hat n)\times r_2)}\cdot \hat n}
$$
where:
\$e\$ is restitution constant
\$\hat n\$ is a contact normal
\$v_r\$ is relative velocity of the contact point
\$m\$ is mass of objects
\$I\$ is moment of inertia tensor
\$r\$ is a vector from center of mass to contact point
Note: I've been assigned value 0.0f to the boxed/highlighted terms in the expression when an object collides with plane.
Then update linear & angular velocity as below:
$$
\begin{align}
v'_1&=v_1-\frac{j_r}{m_1}\hat n \\
v'_2&=v_2+\frac{j_r}{m_2}\hat n
\end{align}
$$
$$
\begin{align}
\omega'_1&={\omega}_1-j_rI_1^{-1}(r_1\times\hat n) \\
\omega'_2&={\omega}_2+j_rI_2^{-1}(r_2\times\hat n)
\end{align}
$$
Those expressions are referenced from the Wikipedia collision response entry.
It works well when two objects collide.
However, the box object rotates strangely and continuously glide around when it collides with plane as below:
(red sphere is detected contact point)
I set contact normal as plane normal.
I assume that the expression has to be modified for the case of fixed object (ex. plane).
I've been assigned value 0.0f to the boxed/highlighted terms in the expression when an object collides with plane.
Is this approach right?
If it isn't, how can I fix this?