Page 1 of 1

Collision detection issue

Posted: Thu Oct 13, 2016 1:22 pm
by mr73412
Hi,

I'm currently trying to integrate a collison detection into my physics simulation (large static sphere and a smaller dynamic box which is falling onto it). I'm using a simulation tick callback to gather the contact information. Now I have the problem that for some initial positions of the box I do not get a contact point with a distance below 0, although the box is bouncing off the sphere.

One of this cases occurs if I use the following values:

Code: Select all

//Sphere
btCollisionShape* sphereShape = new btSphereShape(btScalar(20));
btScalar sphereMass(0.f);
btTransform sphereTransform;
sphereTransform.setOrigin(btVector3(0, 0, 0));

//Box
btCollisionShape* boxShape = new btBoxShape(btVector3(1, 1, 1));
btScalar boxMass(1.f);
btTransform boxTransform;
startTransform.boxTransform(btVector3(18, 25, 0));
In this case I get a contact point when the box touches the sphere, but it is always above 0. However, if I set the transform of the box to (16, 25, 0) I get a valid point with negative distance.

I hope someone can help me. Thanks!