Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sun Nov 05, 2017 2:08 pm 
Offline

Joined: Sun Nov 05, 2017 1:56 pm
Posts: 1
Hello, I have a problem I hope to get help.
I want to create a KINEMATIC body with box shape. I want to change the shape scale dynamically. But once it's changed, there's no collision. What should I do?
Any one can help me, thanks a lot.


Top
 Profile  
 
PostPosted: Wed Nov 08, 2017 8:56 am 
Offline

Joined: Tue Jul 18, 2017 7:48 pm
Posts: 10
yo, probably your body gets deactivated.

I guess if you call body->setActivationState(DISABLE_DEACTIVATION) everything should start to work as expected?


Top
 Profile  
 
PostPosted: Wed Nov 08, 2017 4:43 pm 
Offline
User avatar

Joined: Tue Sep 30, 2014 6:03 pm
Posts: 363
Location: San Francisco
When you change the shape of an object that is in the world you may invalidate the bounding box being used in the broadphase. This isn't a serious problem when the new shape is smaller than the old and is contained inside the old bounding box: maybe your simulation will have to process a few extra narrowphase checks that could have been culled and you waste a few CPU cycles. However, if the new shape is bigger then the simulation might not notice a collision until two objects are deeply penetrating, which causes unexpected penetrations and non-physical results.

So, when you swap in a new shape you should make sure to update the broadphase bounding box. Activating the object will cause this to happen in the next substep automagically, and is probably the best way because it may also activate nearby objects whose deactivated state is dependent on the old object's shape (e.g. they were resting on top of the old shape). However, you can update the bounding box explicitly without activation by using btCollisionWorld::updateSingleAabb().


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Yahoo [Bot] and 20 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group