btTriangleMeshShape RidgidBody not moving except falling

Post Reply
Malarkey
Posts: 1
Joined: Fri Oct 21, 2016 6:15 pm

btTriangleMeshShape RidgidBody not moving except falling

Post by Malarkey »

Hello everyone,

I created a btTriangleMeshShape and created a ridgidBody with it. When I simulate it, gravity seems to affect it, but when it hits the ground, it just sits there, it doesnt react to the collision in any way, even if if should fall over, it just sits there motionless. Other objects created with default CollisionShapes such as cube interact with the btTriangleShape, but not viceversa. The same code also works when exchanging the btTriangleMeshShape with a BoxCollisionShape or any other default one.

The code:

Code: Select all

btCollisionShape* trimeshShape = new btBvhTriangleMeshShape(trimesh, useQuantizedBvhTree);

	btDefaultMotionState* MotionState =
		new btDefaultMotionState(btTransform(btQuaternion(0.76018, 0.29322, 0.56229, 0.14134), btVector3(0, 60, 0)));

	btScalar mass = 1;
	btVector3 fallInertia(0, 0, 0);
	trimeshShape->calculateLocalInertia(mass, fallInertia);

	btRigidBody::btRigidBodyConstructionInfo fallRigidBodyCI(mass, MotionState, trimeshShape, fallInertia);
	fallRigidBodyCI.m_linearDamping = 0.2f;
	fallRigidBodyCI.m_angularDamping = 0.1f;
	PhysicsBody = new btRigidBody(fallRigidBodyCI);
Anybody knows what could be my mistake?
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: btTriangleMeshShape RidgidBody not moving except falling

Post by drleviathan »

Dynamic and kinematic motion types are not supported for rigid bodies that use btTriangleMeshShape. Such bodies can only be static.

Someone once supplied a flow chart to help devs decide which Bullet shape to use based on the characteristics of the object (convex vs concave, dynamic vs static, etc) but I couldn't find it quickly.
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: btTriangleMeshShape RidgidBody not moving except falling

Post by benelot »

We should definitely get this flowchart and post it in the wiki, so that we can start referring to it. There are several problems that could be solved more easily using such documentary features.
Post Reply