Deactivate collision effect

Good evening, I’m using the physics engine of cocos2d-x to detect che body collision. unfortunately I can not solve a problem. if two bodies collide the dynamic body goes in motion. I would like to detect the collision,but the two bodies must remain motionless.

I have already tried the following ways:

  1. simulate a collision between two static bodies, but the collision is not detect

  2. soon recognized the collision between two bodies, the dynamic is destroyed in the process of collision and rebuilt in the post collision. This method works but is poorly efficient, with two bodies at the same time the frame rate drops from 60 to 30 fps

  3. i disable the dynamic body in the collision phase end enable in the post collision. but is useless.

there is no easy way to disable the effects of a collision on a body? I hope in your response, it is really important, I lost two days behind this problem and still do not know how to do.

Hey Asasola,

Have you tried filtering the collision? Have a look at the programming guide, it mentioned something about it; not thoroughly complete but you’ll get the idea.

http://www.cocos2d-x.org/programmersguide/12/#collision

Hope that helps.

very thanks! now its work :slight_smile:

I lost so much time with solutions so complex when the solution was so simple -__-

@Asasola This is something I might need to do soon. Can you post some code for what you did?