0
votes

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 detection. 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?

1
Are you working in 2D or 3D? There's a pretty good article at sacredsoftware.net/tutorials/Collisions/CollisionsPart1.html that might get you started...Reuben Scratton
Are you doing just 2D game with OpenGL? Here "pixel collisions" can make sense. In 3D it's sensless. Also, what kind of collision you mean? Point against polygone? Two polygones against each other?Pointer Null
I already have a solution. I am creating bitmasks of both texture bitmaps and store these masks. The bitmap will be recyled but the masks can still be used. Works good.Basic Coder

1 Answers

2
votes

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!