Several days of fiddling without a fix. Maybe someone can help.
I am using btHeightfieldTerrainShape for terrain and that works. Then the user supplies a new heightmap so I perform the following steps:
Remove the terrain rigid body from the dynamics world
Delete the previous terrain shape and heightmap array
Create a new btHeightfieldTerrainShape with a newly allocated heightmap array
Add the new shape to the existing terrain rigid body
Return the rigid body to the dynamics world
Activate the rigid body
My problem is that this new terrain rigid body does not work: things don't collide with it (ie, no collisions noticed when checking manifolds) and objects just fall through.
Does this ring a bell with anyone? Is there another step that I am missing?
Thanks for any help.
-- mb
Problems replacing terrain shape
-
- Posts: 6
- Joined: Tue Aug 07, 2012 3:27 am
Re: Problems replacing terrain shape
Hello. From my short experience with bullet when I remove/re add btRigidBodies to the dynamicsWorld I had to set them so bullet doesn't put them to sleep.
After you readd the RigidBody
If that doesn't help you could also clear the overlappingpair cache:
Hope that helps.
After you readd the RigidBody
Code: Select all
yourRigidBody->setActivationState(DISABLE_DEACTIVATION);
If that doesn't help you could also clear the overlappingpair cache:
Code: Select all
dynamicsWorld->getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs(yourRigidBody>getBroadphaseHandle(),
dynamicsWorld->getDispatcher());
-
- Posts: 14
- Joined: Wed Apr 28, 2010 3:09 pm
Re: Problems replacing terrain shape
Thanks for the pointers, Shogo. Unfortunately, I have already tried forcing activation and clearing the proxy cache. There are no examples of changing a body's collisionShape in the demo routines so maybe it is something one just doesn't do.
I have worked around this problem by also destroying the RigidBody and recreating everything. That will hold me until I find my coding error.
I have worked around this problem by also destroying the RigidBody and recreating everything. That will hold me until I find my coding error.
