Mhh. I am not on a PC with unity atm but for your planet example you could make your moon a rigidbody and add a velocity to it. now check with ray casts when it hits a planet within a given distance. if so. you could make use of things like centrifugal force and centripetal force. You can find mathematical formulars for them at the internet. And use the "force" feature of the rigidbody so it will look a loot smoother and more realistic. The moon will fly around the planet when centrifugal and centripetal force are equal. hopefully this was helpfull :)
↧