Collisionshape setLocalScale not update without movement

Sord
Posts: 2
Joined: Wed Jul 11, 2012 11:13 pm

Collisionshape setLocalScale not update without movement

Post by Sord »

I use setLocalScale to character's (normal rigid body) collision shape. When going to crouching mode its scale object (every frame when characters height is changed) everything goes well if character is moving. But if not, character is not going down. Character's ridigbody sleepping is disabled. I am also tried rigidbody's activate(force = true) function. To make landing smooth I make that: body->translate(0,(newScale-lastScale)/2,0).

So if object is not moving, collision is not updating? Is there anyway that I can functionally force them?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Collisionshape setLocalScale not update without movement

Post by Erwin Coumans »

You cannot change the collision shape of a rigid body, while it is inside the dynamics world, unless you manually remove the invalid contact points.

The recommended way is to first remove the body from the world, make the change, and re-insert the body.

Alternatively, you can manually try to update the AABB and cached contact points using the 'updateSingleAabb' and 'cleanProxyFromPairs' method:
https://code.google.com/p/bullet/source ... arch+Trunk

Code: Select all

btRigidBody* body=...
dynamicsWorld->updateSingleAabb(body);
dynamicsWorld->getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs(body->getBroadphaseHandle(),getDynamicsWorld()->getDispatcher());
Hope this helps,
Erwin
Sord
Posts: 2
Joined: Wed Jul 11, 2012 11:13 pm

Re: Collisionshape setLocalScale not update without movement

Post by Sord »

Thanks for fast response. Also found just this: http://bulletphysics.org/Bullet/phpBB3/ ... f=9&t=3262 (tried google with setLocalScale, but seems to be Scaling...).