I am trying to get a gameobject (planet) to orbit another gameobject (blackhole) in gradually smaller orbits until the planet collides with the blackhole.
This is my current code:
If I comment out the transform.RotateAround line, the planet approaches the blackhole gradually as desired, but if I allow the transform.RotateAround line to run, the planet orbits, but never approaches the blackhole.
Why is this?
asked Mar 18, 2011 at 02:41 AM
You mixed direct movement(RotateAround) with physic driven movement(AddForce). I recommend to use just direct movement, because you specify all values and the movement isn't really physic based.
You may need to adjust your "50" because it's no longer a force, it's a speed now.
answered Mar 18, 2011 at 03:03 AM
You could also use physics for it by using:
This will make the rigidbody be purely physics based meaning you can alter its trajectory during gameplay using other obects/forces.