Jump to content

  • Log In with Google      Sign In   
  • Create Account


Deactivate a rigid body in Bullet


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
9 replies to this topic

#1 GuyWithBeard   Members   -  Reputation: 770

Like
0Likes
Like

Posted 09 January 2013 - 05:40 AM

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.



Sponsor:

#2 DgekGD   Members   -  Reputation: 374

Like
0Likes
Like

Posted 09 January 2013 - 05:48 AM

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). 



#3 Ashaman73   Crossbones+   -  Reputation: 6735

Like
0Likes
Like

Posted 09 January 2013 - 06:31 AM

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

 

Also, since it refers to islands, will it affect other nearby objects if I do it that way?

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.

 

 

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).

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.



#4 GuyWithBeard   Members   -  Reputation: 770

Like
0Likes
Like

Posted 09 January 2013 - 06:50 AM

Ashaman is right. I don't want to touch the collision flags. Anyway, if you get the chance to look up the "right way" and post it here I'd be grateful. :)



#5 GuyWithBeard   Members   -  Reputation: 770

Like
0Likes
Like

Posted 09 January 2013 - 10:17 AM

Also, I am not looking for code. Just the general idea of how to do it...

#6 GuyWithBeard   Members   -  Reputation: 770

Like
0Likes
Like

Posted 09 January 2013 - 12:35 PM

Right, I tried this out and it seems to work:

mRigidBody->forceActivationState(WANTS_DEACTIVATION);

Is this what you were doing?

#7 xexuxjy   Members   -  Reputation: 563

Like
0Likes
Like

Posted 10 January 2013 - 06:35 AM

Out of interest - why are you wanting to set this yourself rather than letting Bullet set it for you when it thinks the object is actually deactivated?



#8 GuyWithBeard   Members   -  Reputation: 770

Like
0Likes
Like

Posted 10 January 2013 - 08:12 AM

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.



#9 xexuxjy   Members   -  Reputation: 563

Like
0Likes
Like

Posted 10 January 2013 - 09:56 AM

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.



#10 GuyWithBeard   Members   -  Reputation: 770

Like
0Likes
Like

Posted 10 January 2013 - 11:58 AM

Yes, I am simulating on both the client and the server since the server does not send updates across the network on every tick. Using setActivationState might be a good idea. I'll check that out, thanks!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS