I'm able to rotate any model with any angle I want, where I can not rotate my model around a given point.

e.g: My model rotates from the origin assigned in its .fpx file. I want it to rotate related to a point of its bottom plane, so that it is animated as falling

Here is a way to rotate a Matrix (model) around a specific point :

Vector3 pointToRotateAround = modelWorldTransform.Translation +
modelWorldTransform.Down * modelHalfHeight; // modelHalfHeight is meant to represent distance from fbx origin to feet plane

modelWorldTransform *= Matrix.CreateFromAxisAngle(axis, angle);//angle is the angle to rotate just this frame only
modelWorldTransforms.Translation += pointToRotateAround;


pointToRotateAround can be any Vector3 representing a point in 3d space. Make certain that the axis in the Create Method is unit length or your matrix will distort.

• thanks, i've logined to write the answer (i'm quiting to home back), where i see the answer :) same logic works for a single point, too. – icaptan Nov 22 '11 at 15:43

You can use CreateFromAxisAngle method from Matrix class. This method will create a rotation matrix about a specific axis for a given angle.

http://msdn.microsoft.com/en-us/library/bb195606(v=XNAGameStudio.40).aspx

• I could not use it, i've tried and still trying to handle it, but it does not work. is there any sample using that ? it rotates already from its origin does not matter around a point or axis. – icaptan Nov 22 '11 at 9:41
• Finally CreateFromAxisAngle isn't the solution to your problem, I responded too quickly. If you want to rotate around a specific point p, first translate the view matrix of your model to -p, do the rotation and then translate to p. – Julien Pires Nov 22 '11 at 12:02
• Thanks Takumi :) It helped me already, i've learned CreateFromAxisAngle and after all i've solved it same with the Steve H's answer. – icaptan Nov 22 '11 at 15:42