How to do a simple pixel perfect collision?

How to do a simple pixel perfect collision?
0.0 0



This is my third question today, sorry, but i have only this 3 questions that i dont find answer.

Now i need know how to make a pixel perfect collision detection.

Can anyone help me?

I see some very complex solutions, i think that have a simple to do it.

Can anyone give some examples, links, tutorials, source projects?



Can you provide an example where you want the pixel based collision detection be?


You can get my project here:

Android version:

I want check player vs objects (the mill in my game)


save the texture transparent infomation and use it for collision detection;


Do you have an example or tutorial? Or a sample project about it?


Have a look at this:

It’s using Box2D with the physics turned off, just the collision detection. You define collision areas with something like “VertexHelper”. Works a treat, is fast, see my game



There is any utility to create the verts?



Yeah there are a few, some cost cash now tho:

Physics editor (the trace feature):

There are probably some free things, have a google.

Read the turtorial, it says in there too.



I buy VertexHelper now.

Im trying create the verts, but when i use, i get exception here:

b2Assert(area > b2_epsilon);

See the screenshot (attached on post). All the verts that i create i got exception :frowning: What im doing wrong?

Im using a sample verts from the cocos sample project and it works (the sample verts are from your link from gmtdev).

There is a logical structure for it? (the original size of my sprite is 149 x 236) on screenshot it is with zoom.


You have to go anti clockwise



Ok, Thanks!


Doesnt work

Same error


Other test that doesnt works!

Look the error attached!



Now i do it correct. I only translate your “clockwise”, i forgot the “anti” :slight_smile:

Now it is working man, very thanks!


Cool, yeah, in the other direction.


Everything is working nice now!

thanks all.