Android OpenGL: Pixel-Perfect collision without bitmap data
Due to some memory problems I had to textureBitmap.recycle() all texture bitmaps after I created an OpenGL texture. Works great and there is enough memory left.
My problem is that I have absolutely no idea how to implement collision detectio开发者_如何学Pythonn. I dont want just boundingbox tests - thats pretty easy - I want pixel perfect collision detection. I don't use any engine, so I cant use existing libraries. Before working without an engine I used an extension for the AndEngine which worked pixel perfect!
Can you give me a hint, how to implement the collision detection?
The pixel perfect collision library I made for andengine includes a PixelPerfectBitmask that will work on its own.
PixelPerfectBitmask mask1 = new PixelPerfectBitmask(bmp1, 100, 100);
PixelPerfectBitmask mask2 = new PixelPerfectBitmask(bmp2, 100, 100);
Log.v("pp collision", String.valueOf(mask1.collidesWith(mask2, 20, 10)));
If you have any questions, let me know!
精彩评论