2

I want to detect the intersection of two objects (sprites) in my scene. I don't want the object geometric intersection to cause a collision between the bodies in the scene.

I've created PhysicalBody for both of my object shapes, but I can't find a way to detect the intersection without having both bodies hit each other on impact.

I'm using cocos2d-x 3+ with the default chipmunk engine (which I'd like to stick with for now)

The question is, how do I detect the intersection of elements without having them physically push each other when they intersect.

Losiowaty
  • 7,911
  • 2
  • 32
  • 47
Aviran
  • 5,160
  • 7
  • 44
  • 76
  • Well... I don't quite get your question. If two physic bodies intersect, they collide. I don't know about Chipmunk, but in Box2D you can make it so that a "collision" wouldn't cause a physics reaction, but rather send a signal, that these two bodies are touching. Would that be what you are looking for? – Losiowaty Jun 30 '14 at 08:04
  • @Losiowaty yes, exactly that, I've been trying every setting I could think of but I cannot get that result – Aviran Jun 30 '14 at 08:08
  • Well, I have no experience with chipmunk, so I cannot help you further - I added [tag:chipmunk] tag, so that people with more knowledge in it may find your question. – Losiowaty Jun 30 '14 at 08:12

1 Answers1

2

The answer is very simple (Though it took me 2 days to figure it out)

When contact is detected and onContactBegin() is called, when the relevant shape is being hit returning false will stop the physical interaction.

Aviran
  • 5,160
  • 7
  • 44
  • 76