Cocos2d Chipmunk physics problems

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

When my game object falls against the wall below it, it goes through the static body a bit and then the static body pushes out of itself.

It doesn't happen all the time, maybe 50% of the time. The speed is not very high. The game object (dynamic) falls to about half of the phone screen.

A. I only saw this problem a few days ago, it was okay early.

A dynamic Rect object that is subject to gravity allows you to rotate. Density = 1, Friction = 1, Resilience = 0.3 Walls = [CCPhysicsBody bodyWithRect: objectRectForPh cornerRadius: 0], all other physical parameters are default.

No collision handling code

+3


source to share


1 answer


You get this problem because Chipmunk does not support CCD (Continuous Collision Detection). This can be solved (but not 100% guaranteed for me) by using smaller time steps, but it uses more CPU time.



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

+1


source







All Articles