Hi all,
First I would like to thank Erin for the incredible Box2D library. I used it in y first game and it helped me achieve some very nice things. I also would like to thank iforce2d and other contributors for their great support on this forum.
My question is rather general and simple and has already been more or less addressed in other topics but I don't yet find any good solution. Here is the situation: I have a circle (dynamic body) sliding on a terrain (static body) made of chain shapes linked together. Each chain is about 500px width with about 100 segments/edges of about 5px (with a PTM_RATIO of 32):
http://www.slidingsam.com/box2D/screen.jpg
The problem is that, after a while (sometimes rapidly, sometimes it takes more time), the dynamic body is tunneling through the terrain, so falling down endlessly. I'm using Box2D 2.2.1 with Cocos2d-x 2.1.4 and testing on iOS simulator.
Here are some ideas to workaround this problem:
- Set bullet to true for the dynamic body. Done but problem still occur.
- Change the chain shape into a lot of edges shapes. Done but problem still occur.
- Make one big body with all the chain shapes instead of several chains. Still to test.
- Put a box shape below each segment/edge of the chain. Still to test.
- Use a loop shape but I guess the inner shape will be hollow so tunneling is still possible. Still to test.
- Re-coordinate my simulation. I mean the terrain is endless, so maybe I'm having rounding errors due to big world coordinates. Still to test
Thanks for your help!
Sam
First I would like to thank Erin for the incredible Box2D library. I used it in y first game and it helped me achieve some very nice things. I also would like to thank iforce2d and other contributors for their great support on this forum.
My question is rather general and simple and has already been more or less addressed in other topics but I don't yet find any good solution. Here is the situation: I have a circle (dynamic body) sliding on a terrain (static body) made of chain shapes linked together. Each chain is about 500px width with about 100 segments/edges of about 5px (with a PTM_RATIO of 32):
http://www.slidingsam.com/box2D/screen.jpg
The problem is that, after a while (sometimes rapidly, sometimes it takes more time), the dynamic body is tunneling through the terrain, so falling down endlessly. I'm using Box2D 2.2.1 with Cocos2d-x 2.1.4 and testing on iOS simulator.
Here are some ideas to workaround this problem:
- Set bullet to true for the dynamic body. Done but problem still occur.
- Change the chain shape into a lot of edges shapes. Done but problem still occur.
- Make one big body with all the chain shapes instead of several chains. Still to test.
- Put a box shape below each segment/edge of the chain. Still to test.
- Use a loop shape but I guess the inner shape will be hollow so tunneling is still possible. Still to test.
- Re-coordinate my simulation. I mean the terrain is endless, so maybe I'm having rounding errors due to big world coordinates. Still to test
Thanks for your help!
Sam