You are not logged in.

#1 2008-09-04 06:35:06

_CONEJO
Member

pixel-perfect collision

Hello,

Has anyone tried to implement a pixel-perfect collision system? I was looking over internet, most of the sites talk about a library which is rigth now down (sucks) I understand the theory, i could implement it to the easiest case (non-rotated, non-scaled graphics) but not for rotated/scaled graphics. I also don't know how to make a bitmask from an image (ok, i know it in theory, but not in C++), also my way would be very slow, so i was thinking in a batch process and hardcoded them into the program.

Any idea on the topic? where i should start looking for? thanks!

Offline

 

#2 2008-09-04 08:43:06

JyCet
Member

Re: pixel-perfect collision

Hello,
You dont need to use pixel collision every time before you can use bounding box.
After for the pixel collision and like you said you need to a bitmask for each sprite.
I dont know how to use a virtual screen so you need to copy your bitmask on the screen when the bounding box detect a collision and check every pixel before to put the real sprite wink
The idea is:

If bounding box detect collision{
    put your mask on the screen
    check every pixel
    do what you want
}
put your sprite to delete the mask

i hope it help

Offline

 

#3 2008-09-04 14:13:10

_CONEJO
Member

Re: pixel-perfect collision

as i said i already know the theory, but i'm getting a bit lost when sprites are rotated or escaled...

Offline

 

#4 2008-09-04 17:20:17

Crayon
Bad Mother Fucker

Re: pixel-perfect collision

Maybe the answer from Redshade on this page could help you: http://grrlib.santo.fr/forum/viewtopic.php?id=40

Offline

 

#5 2008-09-15 06:28:10

_CONEJO
Member

Re: pixel-perfect collision

I already done my own pixel-perfect collision algorithm, it's pretty simple since i only check point vs object, but it's ok. If anyone want i could clean the code a bit and put it online.

Offline

 

Board footer

Powered by FluxBB