Continous response to change in gravity

JustChris
Posts: 4
Joined: Fri Jan 22, 2010 6:36 pm

Continous response to change in gravity

Post by JustChris »

I have a dynamic body (not kinematic) representing a sphere. The sphere is controlled indirectly, like in one of those marble maze games by tilting it so I chose to use an ever-changing gravity vector that corresponds with the tilt. (this is also a nice way to control the sphere's trajectory during freefall but I won't go too much into that)

The dynamic body is only responsive while it is currently moving. In other words, if the sphere finds a stable position on the board and comes to rest, tilting the board (eg. changing the gravity) has no effect on it. It only starts moving again once another dynamic body comes in contact with it.

I guess this is by default with dynamic bodies, Bullet "freezes" them once they are motionless and are ruled out for checking any updates. But think in another situation it could be used for some other game. A room might have a switch to reverse gravity and all loose objects that are at rest suddenly fly up to the ceiling. I think it should be updating all the dynamic bodies once the gravity starts to change, but for now I want to know how to get the sphere to constantly receive transformation updates.
ola
Posts: 169
Joined: Sun Jan 14, 2007 7:56 pm
Location: Norway

Re: Continous response to change in gravity

Post by ola »

You can disable the deactivation for a rigid body, see this post
http://bulletphysics.org/Bullet/phpBB3/ ... ion#p15454

Also, you can use body->activate() to wake it up if it has fallen asleep.

Cheers,
Ola
JustChris
Posts: 4
Joined: Fri Jan 22, 2010 6:36 pm

Re: Continous response to change in gravity

Post by JustChris »

Thanks, that worked :)