Objects bounce away violently

www20602
Posts: 4
Joined: Thu Jun 27, 2019 12:28 pm

Objects bounce away violently

Post by www20602 »

I am using trimesh to simulate a bunch of small objects.
Parameters are as follows:
restitution 0,
friction .2,
lineardamping and angulardamping .3,
ccdmotionthreshold 1e-7, sphereradius .5
collision margin 1e-6,

I am using the space key to add new small objects.

Sometimes, as is shown in the attached animation,
the boxes bounce away.
Could anyone help explain the reason?
Thank you very much!

gifhome_640x422_8s.gif
You do not have the required permissions to view the files attached to this post.
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Objects bounce away violently

Post by drleviathan »

The little boxes are using btTriangleMeshShape? Or just the big cyan container? Bodies that use btTriangleMeshShape cannot be dynamic else Bad Things happen.
www20602
Posts: 4
Joined: Thu Jun 27, 2019 12:28 pm

Re: Objects bounce away violently

Post by www20602 »

Both are triangle meshes.
Is it because of concavity?
The big cyan container is concave.

The most similar discussion I could find in the forum is
viewtopic.php?t=12009
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Objects bounce away violently

Post by drleviathan »

That old thread is still correct except for one thing: Using btCompoundShape is not the only way to go. The OP might have been able to use Bullet's GImpactShape stuff which allows for dynamic convex shapes.

I would sum it up like so:

(1) btTriangleMeshShape can NOT be used for dynamic objects. The reason is because Bullet has not implemented correct narrow-phase collision logic for btTriangleMeshShape vs btTriangleMeshShape. You can use it for static or kinematic objects.

(2) For a convex dynamic body use an implicitly convex shape type. The simpler the shape the lower the overhead.

(3) For a concave dynamic body use either: btCompoundShape or one of the final btGImpactShapes.
www20602
Posts: 4
Joined: Thu Jun 27, 2019 12:28 pm

Re: Objects bounce away violently

Post by www20602 »

Thanks for the reply.
I have replaced the bowl into a concave static trianglemeshshape
and replaced the boxes into convexhullshapes.
The results are as follows. The results are reasonable.
gifhome_640x520_7s.gif
You do not have the required permissions to view the files attached to this post.
kYamek
Posts: 2
Joined: Fri Jun 28, 2019 7:56 pm

Re: Objects bounce away violently

Post by kYamek »

Quick question - when you set friction to .2, I am assuming that is the friction coefficient between the blocks and the surface. How did you set that up?