# best way to make something orbit

This topic is 3634 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

ok here is my question... I have a starfield that has 300 or so stars put in random positions within a cube of space. I want to place planets orbiting those stars. I see two ways of doing this, 1) Modifying the world matrix Normal world matrix for stars Scale*Rotate*Position Planet Matrix Scale*Rotate*OrbitDistance*OrbitRotation*Position 2) Calculating the position externally and just updating its position manually Planet Position X = (Cos(OrbitRotation)*OrbitDistance)+StarPositionX Planet Position Y = (Sin(OrbitRotation)*OrbitDistance)+StarPositionY Planet Position Z = (Sin(OrbitRotation)*OffPlane)+StarPositionZ or somesuch both of these should yield an orbit, would there be an atvantage to one over the other? oh I should also say I have experimented with dynamic orbit with gravity but it takes alot of tuning to get a stable orbit. [Edited by - Ebola0001 on August 10, 2008 4:43:54 PM]

##### Share on other sites
Depends if these planets are purely graphics effects or if you'll actually want to know their real locations for gameplay/physics inereactions.

##### Share on other sites
the planets will have ships traveling to and from them

##### Share on other sites
I'd recommend option (2) for its simplicity, especially since it doesn't incur any speed or efficiency penalties over that of (1). With the second, your planets' coordinates are already in universe-space, so I suppose it can save you some recalculation.

And yes, if you don't want a true physics simulation, then don't create one.

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5

• 10
• 14
• 30
• 13
• 11
• ### Forum Statistics

• Total Topics
631788
• Total Posts
3002356
×