in the game, has a hero and other some sprites,
how to detect the hero collision with other different sprites;
using the api of onContactBegin.?
in the game, has a hero and other some sprites,
how to detect the hero collision with other different sprites;
using the api of onContactBegin.?
Plz see PhysicsTest->ContactTest for example.
@yue19870813 You need to set contact mask for your bodies, It won’t trigger the callback function by default.
Please use english, for someone who encounter the same problem can search it, thank you.
@yinhua
You can use PhysicsBody::setContactTestBitmask() to set body contact mask value. If you want receive all the contact events, you can simply set this to 0xFFFFFFFF.
You can see the function description for more details.