bullet gravity[SOLVED]


I wish to have some gravity applied on a specific body.
Indeed, I wish 2 things :
– Huge body (huge mass) must attract smaller bodies
– I wish to create ponctual gravity point as a weapon in my game, to attract all things around.

I found in BulletRigidBodyNode, a method called setGravity, but nothing happens, when I set a vector to (100,100,100) for example, on the bodies around.

Is it implemented in bullet for panda? am I wrong on the way to do?

Yes, this method is exposed - obviously, since you would not SEE this method in BulletRigidBodyNode otherwise.

But this method does something else than what you seem to assume. It overrides the world-wide gravity for one particular rigid body. It does not have any effect on other bodies nearby. Setting a custom gravity for a single object is handy when you e. g. want to make individual bodies float (while all the other bodies in the scene fall down due to gravity).

What you would need is some kind of radial force field. The Panda3D built-in physics system has something like this, and PhysX too, but not Bullet. If you want to use Bullet you have to do it by hand, which is not that difficult. Just compute and apply proper gravity to each nearby object. Have a look at this post for an hint: [url]centripetal / centrifugal forces, how could it be done?]

Thanks a lot, I will try to do something like this.

Wow thanks a lot this can really help me out in developing the new game for shooting :slight_smile: