Contact point changes depending on height

sara
Posts: 39
Joined: Thu Mar 24, 2011 3:50 pm

Contact point changes depending on height

Post by sara »

Hi,

I have a demo of an object falling, and colliding with a static cube (which represents the floor).

I am trying to extract information about the first contact (force and contact point). The problem is that, depending on the height from which I drop the object, the contact point changes.

I changed the simulation step to be:

Code: Select all

m_dynamicsWorld->stepSimulation(ms / 1000000.f, 1 , btScalar(1.)/btScalar(300.));
I've also added this initial code:

Code: Select all

m_dynamicsWorld->getDispatchInfo().m_useContinuous=true;
body->setCcdMotionThreshold(0.01);
body->setCcdSweptSphereRadius(0.02f);
I need the contact point to be the same (or very similar) in each example. ¿Any ideas?
sara
Posts: 39
Joined: Thu Mar 24, 2011 3:50 pm

Re: Contact point changes depending on height

Post by sara »

Please....anyone??
xexuxjy
Posts: 225
Joined: Wed Jan 07, 2009 11:43 am
Location: London

Re: Contact point changes depending on height

Post by xexuxjy »

What sort of variation are you getting (and what height values are you using) ? if you're dropping from a different height it's possible that it will have higher velocity and may penetrate further before being pushed back out again.
sara
Posts: 39
Joined: Thu Mar 24, 2011 3:50 pm

Re: Contact point changes depending on height

Post by sara »

Thank you for answering.

I'm dropping the ball from 1 meter, and from 3 meters.

I am getting difference of contact points of about 0.5 meters. I know its not much, but I want to know what can I do to improve this.

The objects I am using are always convex, so the continuous collision detection should be working. I don't care if the simulation is slower...
xexuxjy
Posts: 225
Joined: Wed Jan 07, 2009 11:43 am
Location: London

Re: Contact point changes depending on height

Post by xexuxjy »

Sorry I'm at work so can't actually run this stuff through and see what happens, but do you get consistent results if you use the standard discrete collision detection? Also what size are your objects? could you post your demo code to make it easier to re-create?

Thanks.
sara
Posts: 39
Joined: Thu Mar 24, 2011 3:50 pm

Re: Contact point changes depending on height

Post by sara »

Ok, here it is. Thanks again for your help.

This is the BasicDemo file I'm using. I had to delete some information that did not affect the demo, because it took too much space.

Anyway, I use a very large sphere (18 meter diameter), and throw it from 1 meter and 3 meters high.

I am pretty sure this is about continuous collision detection, because I want to know the first contact point. So I did not make any discrete collision detection tests.
You do not have the required permissions to view the files attached to this post.
xexuxjy
Posts: 225
Joined: Wed Jan 07, 2009 11:43 am
Location: London

Re: Contact point changes depending on height

Post by xexuxjy »

Can't see anything particularly wrong with what you've got. Though as there are external dependenices I can't run your example. You said you're using a sphere to test, have you tried using a sphere shape to simplify things first?
replace btBvhTriangleMeshShape* triMeshShape = new btBvhTriangleMeshShape(mTriMesh,true,true) with btSphereShape* meshShape = new btSphereShape(9.0f) .

Just to confirm , are you on the latest bullet version (2.79 ) ?
sara
Posts: 39
Joined: Thu Mar 24, 2011 3:50 pm

Re: Contact point changes depending on height

Post by sara »

I am using bullet 2.77. I'll download the new version.

To test I use a sphere, but later I will use other non-sphere objects, so I prefer no to change the bounding volume shape.

As I said, the contact points are similar, but I want to know a way to reduce the distance between these points. I tried reducing the timestep, but that did not work.
sara
Posts: 39
Joined: Thu Mar 24, 2011 3:50 pm

Re: Contact point changes depending on height

Post by sara »

I tried the new version of bullet, and still got the same result. Different contact points.
mi076
Posts: 144
Joined: Fri Aug 01, 2008 6:36 am
Location: Bonn, Germany

Re: Contact point changes depending on height

Post by mi076 »

Code: Select all

body->setCcdMotionThreshold(0.00001);
 body->setCcdSweptSphereRadius(0.00001f);
Not sure ccd motion clamp will help here, more likely it will harm, specially with the above values (microscopic squared velocity threshold and embedded sphere radius of 1/100000 m for 18 m sphere).
Try increase internal simulation frequency to 120 Hz, but without ccd, it might help a little..
Look about motion clamping here http://bulletphysics.org/mediawiki-1.5. ... n_Clamping.

P.S. I couldn't complile and test your code, but it may have memory leaks, i mean "new" btVector3s in ObtainForces().
sara
Posts: 39
Joined: Thu Mar 24, 2011 3:50 pm

Re: Contact point changes depending on height

Post by sara »

> Try increase internal simulation frequency to 120 Hz, but without ccd, it might help a little..

I do that by doing:

Code: Select all

m_dynamicsWorld->stepSimulation(1.0/120.0);
or

Code: Select all

m_dynamicsWorld->stepSimulation(ms / 1000000.f,1,1./120.);
??

Anyway, if a disable ccd, I probably would always get different collision points. Right? I'll try it anyway.
mi076
Posts: 144
Joined: Fri Aug 01, 2008 6:36 am
Location: Bonn, Germany

Re: Contact point changes depending on height

Post by mi076 »

i mean m_dynamicsWorld->stepSimulation(ms / 1000000.f,1,1./120.);
(not necessary 1 max substep)
sara
Posts: 39
Joined: Thu Mar 24, 2011 3:50 pm

Re: Contact point changes depending on height

Post by sara »

Ok, I tried with and without ccd. I also change the timestep and I still get different contact points.

I need information about the first contact for my algorithm. The first contact should always be the same, or at least very similar, regardless of the height from which I drop the object. I am getting these results:

Height 1.0: Contact point -0.215801 -0.00808716 -0.500025
Height 1.5: Contact point -0.192411 1.23978e-005 -0.0634562
Height 2.0: Contact point -0.192411 -0.000154495 -0.0634562
Height 2.5: Contact point -0.168497 -0.00191689 -0.297103
Height 3.0: Contact point -0.168497 -8.13802e-005 -0.297103
Height 3.5: Contact point -0.567699 -0.00394678 -0.509197
Height 4.0: Contact point -0.602119 -0.00505352 -0.5731

As you can see, heights 1.5 and 2 are very similar, but height 1.0 is almost 0.5 meters away.

By the way, to calculate the contact point, I am calculating the mean of the contact points the contactManifold returns.
sara
Posts: 39
Joined: Thu Mar 24, 2011 3:50 pm

Re: Contact point changes depending on height

Post by sara »

How can I make ccd work properly?
sara
Posts: 39
Joined: Thu Mar 24, 2011 3:50 pm

Re: Contact point changes depending on height

Post by sara »

I still have this problem. So if anyone knows how I can fix it, please let me know.

Thank you!