btBvhTriangleMeshShape and random obstacles

AxeD
Posts: 36
Joined: Tue Jun 17, 2008 8:28 pm

btBvhTriangleMeshShape and random obstacles

Post by AxeD »

Hi,
I'm using btBvhTriangleMeshShape to simulate few objects on a scene:
a) ball
b) flat track - 3DS object
c) few other objects - 3ds object.
When I throw a ball on a track, ball rolles but it jumps sometimes . Other thing is that those "other objects" are flying until ball hit them, then objects falls onto a track. I set:
a) DynamicsWorld->setGravity(btVector3(0.0,-10.0,0.0));
b) for all objects i have: setMargin(0.02f);

Any hints?

Best regards
AxeD
User avatar
Dragonlord
Posts: 198
Joined: Mon Sep 04, 2006 5:31 pm
Location: Switzerland

Re: btBvhTriangleMeshShape and random obstacles

Post by Dragonlord »

What goes for the ball use a sphere and not a tri-mesh since this is only an approximation. This avoids the jumping. What goes for activation... what did you set the individual objects to? dynamic? kinematic? static?
AxeD
Posts: 36
Joined: Tue Jun 17, 2008 8:28 pm

Re: btBvhTriangleMeshShape and random obstacles

Post by AxeD »

Dragonlord wrote:What goes for the ball use a sphere and not a tri-mesh since this is only an approximation. This avoids the jumping. What goes for activation... what did you set the individual objects to? dynamic? kinematic? static?
Hi,

Code: Select all


#define BALL_TRACK_FRICTION  0.0
#define BALL_RESTITUTION  0.0

      BallStartTransform.setIdentity();      
      BallMass = 5.0f;
      BallStartTransform.setOrigin(btVector3( 0.0,  0.31,  0.7));
      BallShape = new btSphereShape(0.108f);
      BallShape->setMargin(0.02f);
      CollisionShapes.push_back(BallShape);
      BallBody = CreateRigidBody(BallMass, BallStartTransform, BallShape);
      BallBody->setFriction(BALL_TRACK_FRICTION);
      BallBody->setRestitution(BALL_RESTITUTION);


However there is a BALL_TRACK2_PART_FRICTION defined as 0.65, and it changes after some distance.
Track is static(loaded mesh -btConvexTriangleMeshShape), ball (btSphereShape) and other objects (loaded meshes-btConvexTriangleMeshShape) are dynamic. For tests I have used btBoxShape as a track.

Best regards
AxeD
User avatar
Dragonlord
Posts: 198
Joined: Mon Sep 04, 2006 5:31 pm
Location: Switzerland

Re: btBvhTriangleMeshShape and random obstacles

Post by Dragonlord »

Tried GIMPACT for the tri-meshes yet? As far as I know the conventional tri-mesh is not so well suited for moving around.
AxeD
Posts: 36
Joined: Tue Jun 17, 2008 8:28 pm

Re: btBvhTriangleMeshShape and random obstacles

Post by AxeD »

Hi, "shaking and random obstacles" has been eliminated. It looks that a bullet doesn't like to have floor made from triangles. However right now I have some other issue - performance. Is there any way to make bullet work faster? I'm testing it on really slow PC (600MHz :)) and I have noticed, that just before a hit pc drops fps from 50 to 12-15, but only if i use traingleStrip (11 objects fo 50 triangles each). May You have any suggestions?
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: btBvhTriangleMeshShape and random obstacles

Post by pico »

hi,

i struggled with this behavior also for quite some time.

I think this has been already added as Issue 27 to the bug list.

There is indeed a problem with bullet when rolling spheres over a triangle mesh. Instead of rolling straight the sphere will get influenced when hitting triangle edges. When rolling the same sphere over a big box then there are no problems. I think i even spotted that bug in a commercial game that is using Bullet.

In my experience this is greatly influenced by the restitution of both bodies. You can try to set the restitution for both objects (mesh and sphere) to 0 and see if this solves your problem.
AxeD
Posts: 36
Joined: Tue Jun 17, 2008 8:28 pm

Re: btBvhTriangleMeshShape and random obstacles

Post by AxeD »

pico wrote:hi,

i struggled with this behavior also for quite some time.

I think this has been already added as Issue 27 to the bug list.

There is indeed a problem with bullet when rolling spheres over a triangle mesh. Instead of rolling straight the sphere will get influenced when hitting triangle edges. When rolling the same sphere over a big box then there are no problems. I think i even spotted that bug in a commercial game that is using Bullet.

In my experience this is greatly influenced by the restitution of both bodies. You can try to set the restitution for both objects (mesh and sphere) to 0 and see if this solves your problem.
Hi there, I have restitution defined as 0.0, however I have noticed that setting low poly as a floor helps. Other thing is that timeexpensive prediction :/
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: btBvhTriangleMeshShape and random obstacles

Post by pico »

Low Poly helps because you hit less triangle edges.