Im working with the physic engine ODE, and I try to split 3D-Bodys (I use cuboids) into two smaller parts.
Now I have the problem that I dont know how to compute the positions of the “smaller body parts”.
What I have is:
-The rotation matrix of my cuboid
-The center point of the cuboid
-The side lenghs of the cuboid
Here I have a sketch:
So I need somehow to compute the Point P2 and P3, this will be the center points of the small body parts, so I can simulate the break of my body.
I hope somebody can help me out, or maybe had the same problem and solve it another way, couse I really have a hard time with this
Just assume P1 is at the origin, and the body is not rotated. Then the split operation is easy, P2 will be at -l/4 and P3 at l/4 along the split axis.
Next you apply the rotation matrix to the new points, and then you add the real position of P1. This should give you the correct points.
For example, let’s assume you want to split along the x axis, M is the rotation matrix, P1 is the original center and l is the length along the x axis:
P2 = M * (-l/4,0,0) + P1
P3 = M * (+l/4,0,0) + P1
Note that the matrix multiplication is the same as just taking the first column of the matrix and multiplying it by ±l/4, because the other vector components are zero.
Thanks very much, now it works great !