Today I implemented the piece of code that resolves the interpenetration.
In the particle engine it simply moved the objects back by an amount of the interpenetration proportional to their masses.
Here it also needs to account for the orientation.
The code calculates the inertia of the linear component and the inertia of the rotation component, and the penetration is resolved proportionally to their values.
Also, since big rotations could cause problems, if the amount of rotation is too big, part of it is still resolved as linear penetration.
Nessun commento:
Posta un commento