Sign in to follow this  
Ebola0001

best way to make something orbit

Recommended Posts

Ebola0001    138
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 this post


Link to post
Share on other sites
Wyrframe    2426
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this