Pixel collision detection for v3.x

Think logically dude.
U need to move the sprite1 so it can collide with sprite2.
Using onTouchMoved.
Set it to true:

void HelloWorld::update(float delta) {

if (PixelCollision::getInstance()->collidesWithSprite(Ship1, Ship2) == true) {
    CCLOG("is collision");
}

}

thank you for you sharing ,its very kind of you.But i find a problem .
//SDEBUG(LEVEL_DEBUG, “dragging”, “Collision test (intersects/pixelPerfect): retVal=%s; rect1=%s; rect2=%s; intersection=%s; numPixels=%d; CC_CONTENT_SCALE_FACTOR=%.2f; s1.scale=%.2f; s2.scale=%.2f;”,
//BOOLStr(retVal), RectStr(r1), RectStr(r2), RectStr(intersection), numPixels, CC_CONTENT_SCALE_FACTOR(), sprite1->getScale(), sprite2->getScale());
what is the SDBUG and BOOLStr

Thank you for this work!
I have to test it :smile:

How is performance wise? specially in low-end mobile devices.
I’m using two ETC1 textures for my sprite atlasheet (RGB + alpha split). It might be useful to use only the alpha texture to perform this test.

Thanks
Dredok

Dear , i find a big problem.It works well when i open then debug model ,but when i close debug, it just work as a boudingBox,I use the 2dx-3.3。

Just like others said it’s working like a bounding box…

Hi - I was looking at this line in PixelCollision::collidesWithSprite, and sometimes collisions don’t work. Is this because my sprites do not have the same parents ? Sometimes it seems that r1.intersectsRect(r2) returns false, even though they appear to overlap on screen.

Is this a bug ? I am using cocos2d-x 3.13.1