Sign in to follow this  
GuyWithBeard

Deactivate a rigid body in Bullet

Recommended Posts

GuyWithBeard    1890

Hiya,

 

I realize that this is a question best asked on the Bullet forums, but here goes anyway...

 

What is the correct way to deactivate an RB that is active? Ie. "put to sleep". There is an activate() method but no deactivate(). There is something called forceActivationState(), so I guess I could just pass ISLAND_SLEEPING to that, but it seems awfully hacky. Is there a cleaner way? Also, since it refers to islands, will it affect other nearby objects if I do it that way?

 

Some other engines have methods for putting objects to sleep regardless of their current state.

Share this post


Link to post
Share on other sites
DgekGD    374

I guess, you can use btRigidBody::setFlags method and set proper flags to configure behavior for your rigid body. Here is a list of all flags(line 117). 

Share this post


Link to post
Share on other sites
Ashaman73    13715

I have implemented this behaviour with bullet, but I can't look it up at the moment.

 

[quote name='GuyWithBeard' timestamp='1357731652' post='5019419']
Also, since it refers to islands, will it affect other nearby objects if I do it that way?
[/quote]

ISLAND_SLEEPING is set, when a group of nearby objects is deactivated, I believe that this is not the correct way, but I will look it up later.

 

 

[quote name='DgekGD' timestamp='1357732134' post='5019422']
I guess, you can use btRigidBody::setFlags method and set proper flags to configure behavior for your rigid body. Here is a list of all flags(line 117).
[/quote]

The flags at 117 affects the collision behavior of the object. In this case you want to keep the behaviour and just disable the active physical control by the physics engine until an other object triggers it again or you manually activate it again.

Share this post


Link to post
Share on other sites
GuyWithBeard    1890

I am doing networked physics. As long as the RB on the server is active it sends updated transforms to the client every x milliseconds. When it gets deactivated it sends a deactivated-message to the client and stops sending transforms. At this point the client RB needs to be moved to the last known server RB position, and get deactivated, so that the RBs are in sync across the network. If I don't do this there is a slight chance that the RB on the client is not deactivated when the server RB is, and it keeps moving around when it should stay in place.

Share this post


Link to post
Share on other sites
xexuxjy    1477

Ok, makes sense. just had a quick check through as I'd forgotten how this stuff worked exactly, but you should just be able to call :

 

setActivationState  rather then forceActivationState as the former will honour the disable deactivation /simulation states while the latter won't.

 

it sounds like you're running stepSimulation on the client as well ? (to allow local collision query calls) so the RB would be brought back to life anyway if it was required.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this