   rotating model around axis
  I can currently draw a model, but how can I rotate an model around its position, for example position Vector3(100,0,100)When I use Matrix.CreateRotationY it rotates around the Y-axis (0,0,0)   
  Do you mean about the models local Y axis? If so, you want to translate the model to the origin, rotate, and then translate it back. I.e. create 3 matrices:matA = Translate to originmatB = Rotate about Y axismatC = Translate back to original positionFinal Matrix = matA * matB * matC   ;  I mean to rotate an model on a position.For example the camera is standing on (0,0,0) (and staying) and the model is on position (100,0,100) and rotating around its origin.   I tried the following    effect.World *= Matrix.CreateTranslation(pos);    effect.World *= Matrix.CreateRotationY(45);    effect.World *= Matrix.CreateTranslation(0, 0, 0);   but it doesn't work.;Quote:Original post by AlexkrI tried the following    effect.World *= Matrix.CreateTranslation(pos);    effect.World *= Matrix.CreateRotationY(45);    effect.World *= Matrix.CreateTranslation(0, 0, 0);   but it doesn't work.That should be:effect.World = Matrix.CreateTranslation(-pos);  // Move from pos to (0, 0, 0)effect.World *= Matrix.CreateRotationY(45);// Rotate (about origin)effect.World *= Matrix.CreateTranslation(pos);  // Move from (0, 0, 0) to posAssuming effect.World does not contain any relevant transform beforehand.   ;  The object models have rotated. But when moving my ship in the space, all objects move into another direction. Why does this happen?I use the following: x -= (float)Math.Cos(r ) * player.speed; z -= (float)Math.Sin(r ) * player.speed;to move the ship around in the world.  ( r can be changed with the left and right cursor keys)The objects get drawn on ( -x + objectposition.x)  and (-z + objectposition.z)My drawing code is as follows    public void drawmodel(Vector3 camerapos, Texture2D TheTexture, Model t, Vector3 pos, float mr, float r, float aspectratio)    {   Matrix[] transforms = new Matrix[t.Bones.Count];   t.CopyAbsoluteBoneTransformsTo(transforms);   foreach (ModelMesh mesh in t.Meshes)   {  foreach (BasicEffect effect in mesh.Effects)  { effect.EnableDefaultLighting(); effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f),aspectratio, 1.0f, 10000.0f); effect.World = transforms[mesh.ParentBone.Index];if (mr != 0){    effect.World *= Matrix.CreateTranslation(-pos);    effect.World *= Matrix.CreateRotationY((float)mr);}  effect.World *= Matrix.CreateTranslation(pos);   effect.Texture = TheTexture; effect.TextureEnabled = true; effect.View = Matrix.CreateLookAt(camerapos, Vector3.Zero, Vector3.Up);}  mesh.Draw();   }    }[Edited by - Alexkr on May 14, 2009 5:42:41 PM]