Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocos2d Chipmunk physics issue

I am working on the game with chipmunk physics (SpriteBuilder + Cocos2d v3). There is one game object with dynamic body and several "walls" (static bodies).

When my game object falls to the wall under it, it passes some through static body a bit and then the static body pushes out of himself.

This doesn't happens all times, may be 50% times. Velocity isn't very high. Game object (dynamic) falls about half of phone screen.

And. I've seen this issue only some days ago, early all was fine.

Dynamic object Rect, affected by gravity, allows rotation. Dencity = 1, Friction = 1, Elasticity = 0.3 Walls = [CCPhysicsBody bodyWithRect:objectRectForPh cornerRadius:0], all other physic parameters default.

There is no any collision handling code

like image 204
user3770313 Avatar asked Feb 18 '26 09:02

user3770313


1 Answers

You get this problem because Chipmunk doesn't support CCD(Continuous Collision Detection). This can be solved(but as for me is not 100% guarantee) by use smaller time steps, but it uses more CPU time.

More info on official forum https://chipmunk-physics.net/forum/viewtopic.php?f=1&t=2149

like image 136
KAMIKAZE Avatar answered Feb 20 '26 12:02

KAMIKAZE



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!