Sphere penerating triangle collision mesh

phyman
Posts: 2
Joined: Mon Nov 18, 2013 11:10 pm

Sphere penerating triangle collision mesh

Post by phyman »

Hi,

I have question regarding the function:

stepSimulation( btScalar timeStep,int maxSubSteps, btScalar fixedTimeStep);

For my Android game the frame rate is typically 10-25 fps for devices that don't have hardware
FPU support. The physics runs very slowly as a result.
To fix this I tried 2 things:
1. I increased maxSubSteps to 3 and set fixedTimeStep to 1/20 or 1/30. This resulted in the physics running at more or less the correct speed but the frame rate died horribly due to the sub-steps.
2. Dynamically set the fixedTimeStep to the current game time step. This worked well as the game is now playable but unfortunately objects penetrate static triangle meshes occasionally even though they're not moving fast.
3. Don't support non hardware FPU devices.

Does anyone have a solution?
I would prefer to use method 2 and fix the object penetration issue.

Any help would be greatly appreciated!
lunkhound
Posts: 99
Joined: Thu Nov 21, 2013 8:57 pm

Re: Sphere penerating triangle collision mesh

Post by lunkhound »

To fix the objects penetrating your static meshes you could try using CCD (continuous collision detection). See bullet/Demos/CcdPhysicsDemo/CcdPhysicsDemo.cpp for an example.
However, I think you'll find that other problems will crop up if you go down the road of large, variable-sized fixedTimeSteps.
phyman
Posts: 2
Joined: Mon Nov 18, 2013 11:10 pm

Re: Sphere penerating triangle collision mesh

Post by phyman »

Thanks for the reply, I will try using ccd. I hope this will solve the problem.
It does appear that I need.to work out what the average frame rate is for the game for a given device so I can set the fixed time step. Setting it dynamically is obv a bad idea.