1. ## Rotation Matrcies

Hi

I have a 3D object.

I would like to perform a 3D rotation about its COM (centre of mass), in terms of theta and phi. Not about the axes. I did have a piece of code to do this, but have lost the official reference for where I saw this worked out in more detail. I know it was a coupled combination of a rotation by theta and then phi for example.

Can anyone point me to a good source of information on this.

Thanks

Dis

2. Maybe I don't have a good enough imagination, but I don't know what it means to do a 3D-rotation about a point. You can do a rotation about any arbitrary axis (doesn't have to be a coordinate axis). Any slightly reasonable book titled "Mathematics for 3D Graphics" or similar will have a section on how to decompose rotations.

3. Finding the center of mass in a game object is a simple process of averaging all the locations of the various point masses of your object. Note that you would use local or model coordinates for the calculation but for physics calculations you would use the world coordinates.

If you think of this new point as a displacement from the origin then you have the axes you need for rotation. The axes extend from this point towards and away from zero to infinity.
A point in 3D space should really be thought of as a displacement from the origin or moreso a vector. I would drop the notation of a point because it's misleading.

For instance a point 2,2 is 2 units away from the x origin and 2 units away from the y origin. So even though 2,2 is said to be a point it could equally be expressed as a vector displacement from the origin.

Since matrix transformations are cumulative you would translate in model space to the new vector that represents the center of mass of the object and then you would rotate. Since you have translated away from the origin and then rotated the rotation will now be about the center of mass. By translating you really have effectively moved the origin from 0,0,0 to your center of mass. Now all rotations done after this transformation will be relative to your translated location or more appropriately your new local origin.

4. The DirectX documentation has some good resources for transformation matrices, not as good as a book but as far as free resources go it's not bad.

5. Thanks guys

The problem is I have implemented code that I wrote 2.5 years ago and cannot find my reference to how I actually performed the COM part. Its quite involved and I suspect it involves rotating the co-ordinate axes. I am rather embarrassed because I cannot remember the reference... "Let this be a lesson to you all". I now my code words and use it, but cannot remember how I came by it in the first place and now hoping if you guys might know.

Thanks again.