Pixel Collision Performance Question


(Bora Kasap) #1

What if i use pixel collision check inside a hitbox(actually not hitbox, just a rect) collision check? Is this makes better performance or not?


(Jacob Albano) #2

Flashpunk does a hitbox check first before using any of the more specialized checks. You’d actually be potentially decreasing performance.


(Bora Kasap) #3

but i’ve looked at declaration of pixelmask collision check, i could not see any flashpunk filter, it is using adobe.flash hittest directly. Maybe i miss something…


(Jacob Albano) #4

The basic Mask class checks the bounding box before calling the specific logic, like collideGrid() or collidePixelmask(). It doesn’t use Hitbox directly, but it’s the same thing.

Trust me on this; I’ve been porting Flashpunk to C# and I’m intimately acquainted with its inner workings… :wink:


(azrafe7) #5

I’ve been porting FlashPunk to Haxe as an exercise and can confirm what @jacobalbano said. That optimization is already in place.

(yeah I know there’s an HaxePunk already, infact it ended up quite similar)


(Daniel Berg) #6

I would be thouroughly intrested in having a look at that C# port if at all possible.


(Jacob Albano) #7

Sure thing! It’s right here: https://bitbucket.org/jacobalbano/punk


(Daniel Berg) #8

I’m loving it! I’m gonna take a much closer look at this soon, right now I have some pressing matters to attend to before my attention is free, but thats just awesome. If its ok, can I contact you later about some details concerning possible application of this in some other projects I’m working on? P.S. this is fairly off topic, but I figured original question has been resolved.


(Jacob Albano) #9

Yep, not a problem. :slight_smile: