Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Mon Jan 16, 2012 5:17 pm 
Offline

Joined: Thu Mar 24, 2011 3:50 pm
Posts: 39
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:
m_dynamicsWorld->stepSimulation(ms / 1000000.f, 1 , btScalar(1.)/btScalar(300.));


I've also added this initial code:

Code:
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?


Top
 Profile  
 
PostPosted: Tue Jan 17, 2012 9:26 am 
Offline

Joined: Thu Mar 24, 2011 3:50 pm
Posts: 39
Please....anyone??


Top
 Profile  
 
PostPosted: Tue Jan 17, 2012 11:33 am 
Offline

Joined: Wed Jan 07, 2009 11:43 am
Posts: 98
Location: London
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.


Top
 Profile  
 
PostPosted: Tue Jan 17, 2012 12:00 pm 
Offline

Joined: Thu Mar 24, 2011 3:50 pm
Posts: 39
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...


Top
 Profile  
 
PostPosted: Tue Jan 17, 2012 1:38 pm 
Offline

Joined: Wed Jan 07, 2009 11:43 am
Posts: 98
Location: London
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.


Top
 Profile  
 
PostPosted: Tue Jan 17, 2012 6:11 pm 
Offline

Joined: Thu Mar 24, 2011 3:50 pm
Posts: 39
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.


Attachments:
BasicDemoTemp.cpp [12.64 KiB]
Downloaded 48 times
Top
 Profile  
 
PostPosted: Tue Jan 17, 2012 8:23 pm 
Offline

Joined: Wed Jan 07, 2009 11:43 am
Posts: 98
Location: London
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 ) ?


Top
 Profile  
 
PostPosted: Wed Jan 18, 2012 9:52 am 
Offline

Joined: Thu Mar 24, 2011 3:50 pm
Posts: 39
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.


Top
 Profile  
 
PostPosted: Wed Jan 18, 2012 10:43 am 
Offline

Joined: Thu Mar 24, 2011 3:50 pm
Posts: 39
I tried the new version of bullet, and still got the same result. Different contact points.


Top
 Profile  
 
PostPosted: Wed Jan 18, 2012 12:01 pm 
Offline

Joined: Fri Aug 01, 2008 6:36 am
Posts: 144
Location: Bonn, Germany
Code:
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.8/index.php/Anti_tunneling_by_Motion_Clamping.

P.S. I couldn't complile and test your code, but it may have memory leaks, i mean "new" btVector3s in ObtainForces().


Top
 Profile  
 
PostPosted: Wed Jan 18, 2012 12:16 pm 
Offline

Joined: Thu Mar 24, 2011 3:50 pm
Posts: 39
> Try increase internal simulation frequency to 120 Hz, but without ccd, it might help a little..

I do that by doing:

Code:
m_dynamicsWorld->stepSimulation(1.0/120.0);

or
Code:
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.


Top
 Profile  
 
PostPosted: Wed Jan 18, 2012 12:56 pm 
Offline

Joined: Fri Aug 01, 2008 6:36 am
Posts: 144
Location: Bonn, Germany
i mean m_dynamicsWorld->stepSimulation(ms / 1000000.f,1,1./120.);
(not necessary 1 max substep)


Top
 Profile  
 
PostPosted: Wed Jan 18, 2012 1:30 pm 
Offline

Joined: Thu Mar 24, 2011 3:50 pm
Posts: 39
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.


Top
 Profile  
 
PostPosted: Fri Jan 20, 2012 10:01 am 
Offline

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


Top
 Profile  
 
PostPosted: Tue Jan 24, 2012 9:34 am 
Offline

Joined: Thu Mar 24, 2011 3:50 pm
Posts: 39
I still have this problem. So if anyone knows how I can fix it, please let me know.

Thank you!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: Exabot [Bot], Google [Bot], TheIvanHouse and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group