Objects with different centers of gravity?

jbrads
Posts: 2
Joined: Wed Jun 18, 2008 7:56 pm

Objects with different centers of gravity?

Post by jbrads »

Hi All,

I'm currently researching a gameplay demo I’m planning, however there are a number of physics challenges I believe I will need to overcome, I was hoping I could draw upon the experience of the Bullet community to evaluate whether Bullet can solve my requirements, I must admit now I am no Bullet guru and I have only dabbled.

This is my scenario....

The main zone is zero gravity.

The player will fly around this zone and is required to land on and walk around various objects.

These objects have there own centre of gravity, some may be spherical, and others may be flat platforms or even a cube for example.


This is how I would try to achieve the above, this is all up for debate of course :)


When it comes to the creation of the physics world, I create the main physics world with zero gravity.

When the player is within a certain range of an object, I apply a 'fake' gravity in the form of an impulse in the direction of the objects centre of mass

I give the object being landed on a low friction value so the player can slide around the object as if they where walking on its surface, whilst the fake gravity impulse is still pushing them down onto the surface?

To detach the player from the object, I would apply an impulse in the opposite direction to the 'fake gravity' to propel the player out of the objects range.

Please let me know your thoughts.

btw, this is not anything on a planetary scale, more of an experimental game play idea 8)

Cheers,
John
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Objects with different centers of gravity?

Post by Erwin Coumans »

If you like mimic an effect like Super Mario Galaxy, yes this is possible in several ways.

Note that each rigid body has its own gravity vector, so you can set gravity manually every frame (after they have been added to the dynamics world).

Thanks,
Erwin
jbrads
Posts: 2
Joined: Wed Jun 18, 2008 7:56 pm

Re: Objects with different centers of gravity?

Post by jbrads »

Thanks Erwin,

Using each body’s gravity vector seems a far better approach than applying an impulse.

I have not come across this effect in Super Mario Galaxy, so I’ll be sure to look it up.


EDIT: That is exactly the effect I’m trying to achieve.

I’m now wondering if changing the gravity vector to the objects centre of mass is just enough, and whether I need to maintain a more precise gravity down vector.

Thanks,
John