Why is my btTriangleMeshShape nonmoving?

tunnuz
Posts: 11
Joined: Wed Dec 01, 2010 8:37 am

Why is my btTriangleMeshShape nonmoving?

Post by tunnuz »

Hello. I am building a btTriangleMesh out of an Ogre::Mesh, and then creating a btBvhTriangleMeshShape from it. For some reasons, though, when I try to evaluate its AABB with respect ot a btCollisionObject transform, I always get the same position. Is this normal? Do triangle meshes have some limitations on movements?

Two more details:
  • 1. When I represent my mesh with a single btCapsuleShape the position is updated correctly and all is fine.
    2. I am not doing any physical simulation as I am using the btCollisionWorld to perform raycasting on objects.
This is somehow an update to my last post.

Thank you
Tunnuz
Dominik
Posts: 32
Joined: Fri Dec 19, 2008 2:51 pm

Re: Why is my btTriangleMeshShape nonmoving?

Post by Dominik »

Hi

Code: Select all

mObject->getCollisionShape()->getAabb()->(identity, min, max);
This always returns the AABB of the collision shape only, (since you transform it by the identity).
Keep in mind that a collision shap eis only the actual shape, without a 3D position/orientation. After all, one shape could be used by multiple collision objects.
To get the AABB of the actual collisionobject, either transform the Shape's AABB accordingly, or use the object's broadphase proxy.
skeen
Posts: 24
Joined: Wed Dec 08, 2010 11:59 am

Re: Why is my btTriangleMeshShape nonmoving?

Post by skeen »

tunnuz wrote:Hello. I am building a btTriangleMesh out of an Ogre::Mesh, and then creating a btBvhTriangleMeshShape from it. For some reasons, though, when I try to evaluate its AABB with respect ot a btCollisionObject transform, I always get the same position. Is this normal? Do triangle meshes have some limitations on movements?

Two more details:
  • 1. When I represent my mesh with a single btCapsuleShape the position is updated correctly and all is fine.
    2. I am not doing any physical simulation as I am using the btCollisionWorld to perform raycasting on objects.
This is somehow an update to my last post.

Thank you
Tunnuz
As far as I recall; btBvhTriangleMeshShape=static, you'll want to be using btConvexTriangleMeshShape instead. Both of these are btCollisionShapes, its just something about btBvhTriangleMeshShape being optimized for something :)
tunnuz
Posts: 11
Joined: Wed Dec 01, 2010 8:37 am

Re: Why is my btTriangleMeshShape nonmoving?

Post by tunnuz »

Dominik wrote:Hi

Code: Select all

mObject->getCollisionShape()->getAabb()->(identity, min, max);
This always returns the AABB of the collision shape only, (since you transform it by the identity).
Keep in mind that a collision shap eis only the actual shape, without a 3D position/orientation. After all, one shape could be used by multiple collision objects.
To get the AABB of the actual collisionobject, either transform the Shape's AABB accordingly, or use the object's broadphase proxy.
Yeah! I know, I have changed my code after fido's reply to the old post. However I guess that the explanation is the one provided by skeen. That kind of shape is static and therefore cannot be moved.
Dominik
Posts: 32
Joined: Fri Dec 19, 2008 2:51 pm

Re: Why is my btTriangleMeshShape nonmoving?

Post by Dominik »

Nope, static does not mean that it can't be moved, it only means that its dynamics cannot be simulated by the physicsworld. As far as I know, it should behave exactly the same way as other shapes if you use it solely for collision detection.

Could you post some code where it fails? And did you try accessing the BroadphaseProxy?
tunnuz
Posts: 11
Joined: Wed Dec 01, 2010 8:37 am

Re: Why is my btTriangleMeshShape nonmoving?

Post by tunnuz »

Dominik wrote:Could you post some code where it fails? And did you try accessing the BroadphaseProxy?
I am not accessing the BroadphaseProxy. However it was probably something else, because now with btBvhTriangleMeshShapes it works correctly.