0
votes

I have planets rotating around Sun. Sun is in the middle.

I want to make planets rotate around both the sun and their own axis.

My rotation code is:

 world_.SetValue(Matrix.CreateRotationZ(-(float)
                  ((gameTime.TotalGameTime.TotalSeconds % 100) * 2 * Math.PI / 100)));

It seemed to me as something easy to implement (since i can do that in OpenGL, Android etc) but for some reason im stuck...

1

1 Answers

0
votes

You want to transalate orbiting planet and rotateit around own axis.

worldMatrix=scaleMatrix * rotateMatrix(around own axis) * translateMatrix(around the sun)