Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm using this script: http://wiki.unity3d.com/index.php/Simple_planetary_orbits

to get a solar system going in Unity, but it doesn't seem to support creating bodies that orbit other moving bodies (or I am using it incorrectly).

Any idea about how to modify it so that it does (or just use it correctly)? I've been beating my head against this problem for a couple hours, and I really don't feel like I have any idea what I'm doing.

Thanks in advance.

share|improve this question
5  
You should check out the 3 body problem for the history of this problem and why it often has to be faked in games. – DampeS8N Nov 19 '12 at 19:55
add comment (requires an account with 50 reputation)

1 Answer

It seems that the property

var orbitAround : Transform;

is a stationary object. You'll need to modify the code to allow this to be updated, so as your planet moves around the sun, it's moons have to revolve around the center of the planet.

share|improve this answer
4  
Tranforms make up the scene graph/object hierarchy in Unity, so this value shouldn't need to change - it just needs to point to the relevant object. So, a Moon object would have orbitAround=Earth, and the Earth object would have orbitAround=Sun, etc. – Kylotan Nov 19 '12 at 16:51
add comment (requires an account with 50 reputation)

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.