Hi folks,
I was wondering whether it is possible to specify an "arbitrary" gravitational force, that is not to use the "gravitation" property which sets one gravitation direction for the whole world, but to set the position of some gravitational object. I would need this to model a planet on whose surface one can then move without "falling" in either direction.
Also this could be used to calculate the trajectories of planets in a solar system.
Does such a thing exist in Bullet?
Arbitrary gravitational forces to model a planet
-
- Posts: 229
- Joined: Sun Sep 30, 2007 7:58 am
Re: Arbitrary gravitational forces to model a planet
Hi,
use a ghost object around your planet. Make it as large as the gravity should affect other bodies. Then iterate through all bodies that touch the ghost object and apply an impulse towards the center of your ghost object. Adjust the impulse strength according to the distance of the body to the center of the ghost object.
use a ghost object around your planet. Make it as large as the gravity should affect other bodies. Then iterate through all bodies that touch the ghost object and apply an impulse towards the center of your ghost object. Adjust the impulse strength according to the distance of the body to the center of the ghost object.
-
- Posts: 2
- Joined: Sat Jan 10, 2009 2:44 pm
Re: Arbitrary gravitational forces to model a planet
Thanks a lot!
I'll give it a try.
I'll give it a try.