I am building a 3D simulation.
I am using one class to display sun, planets & moon with different size, texture, speed and orbit. Here's my code which does the magic job of calculating rotation + revolution
world = Matrix.CreateScale(size,size,size) * Matrix.CreateTranslation(0,0,0) *
Matrix.CreateRotationY(rotation) *
Matrix.CreateTranslation(position) *
Matrix.CreateRotationY(revolution);
- size is my variable to scale the object individually
- rotation is my variable to rotate the object around its own axis
- position is my variable to position the planet on orbit, new Vector3(240,0,0)
- revolution is my variable to revolve the planet around the origin
now i want the display the moons around earth and around other planets but i just can't figure out how to do it. In terms of Matrix Multiplication.
The complication is the moon's revolution is around a planet which is not on origin and is always changing.
How to do it ?