- Forums
- »
- Programming with Haxe
- »
- Pixel Perfect Collision Detection
|
Viewing 1 to 20 (23 Total) Pixel Perfect Collision Detection |
|
|---|---|
wtsnzTotal Posts: 74
Joined: September 11, 2011
|
I am currently playing with a few idea's and most of them require some form of pixel perfect collision detection between sprites.. I have a .png image (with transparency) that I draw into a sprite and would like to know how to get pixel perfect collision detection.
Tags:
Posted on October 13, 2011 at 6:13 PM
|
levelbylevelTotal Posts: 35
Joined: September 14, 2011
|
Re: Pixel Perfect Collision DetectionHow odd, I've literally just had this issue :p
Posted on October 13, 2011 at 7:17 PM
|
levelbylevelTotal Posts: 35
Joined: September 14, 2011
|
Re: Pixel Perfect Collision DetectionJust remembered it came from an old flash game tutorial series by Michael J Williams, don't think the class was his though.
Posted on October 13, 2011 at 7:22 PM
|
wtsnzTotal Posts: 74
Joined: September 11, 2011
|
Re: Pixel Perfect Collision DetectionGreat thanks for that!
Posted on October 13, 2011 at 7:30 PM
|
ZaphodTotal Posts: 218
Joined: September 15, 2011
|
Re: Pixel Perfect Collision DetectionI want to help with this error:
Posted on October 14, 2011 at 12:44 AM
|
levelbylevelTotal Posts: 35
Joined: September 14, 2011
|
Re: Pixel Perfect Collision DetectionZaphod, give it one of these:
Posted on October 14, 2011 at 4:40 AM
|
ZaphodTotal Posts: 218
Joined: September 15, 2011
|
Re: Pixel Perfect Collision DetectionI forgot to say that blendMode in cpp must be lowercase.
Posted on October 14, 2011 at 8:17 AM
|
singmajestyTotal Posts: 2191
Joined: August 25, 2011
|
Re: Pixel Perfect Collision DetectionIn a game I created with NME, I wanted pixel-perfect point detection, for mouse overs.
Posted on October 14, 2011 at 6:35 PM
|
levelbylevelTotal Posts: 35
Joined: September 14, 2011
|
Re: Pixel Perfect Collision DetectionOk, I've sort of fixed the class... ... ... I think... ... (would need more testing maybe).
Posted on October 14, 2011 at 6:57 PM
|
wtsnzTotal Posts: 74
Joined: September 11, 2011
|
Re: Pixel Perfect Collision DetectionJust tried the new class levelbylevel and it's a no go.. It compiles without errors, but no collisions are detected.
Posted on October 14, 2011 at 7:05 PM
|
levelbylevelTotal Posts: 35
Joined: September 14, 2011
|
Re: Pixel Perfect Collision DetectionAlas, lol, back to the drawing board...
Posted on October 14, 2011 at 7:10 PM
|
wtsnzTotal Posts: 74
Joined: September 11, 2011
|
Re: Pixel Perfect Collision DetectionProbably not the best idea, but would it be possible to create a temporary DisplayObject for each displayObject the collision is between, and then adding them as a child to the temporary displayObject, then grabbing the width + height (Will work for if it rotated I think..), thus creating the bounding box, even when its rotated...
Posted on October 14, 2011 at 7:13 PM
|
levelbylevelTotal Posts: 35
Joined: September 14, 2011
|
Re: Pixel Perfect Collision DetectionI did try something similar to that, made my display objects disappear from the stage for some reason :p To be fair the attempt was lost amongst a million different "solutions" with lots of traces and lots of commented out code :p
Posted on October 14, 2011 at 7:17 PM
|
wtsnzTotal Posts: 74
Joined: September 11, 2011
|
Re: Pixel Perfect Collision DetectionHaha, This is currently what I'm doing for my bounding box collision test with rotated sprites (They're rectangles, but they are rotated at either 0, 90, 180, 270 degrees, so it's ok)
Attachments:
explanation.png
Posted on October 14, 2011 at 7:21 PM
|
levelbylevelTotal Posts: 35
Joined: September 14, 2011
|
Re: Pixel Perfect Collision DetectionNice drawing
Posted on October 14, 2011 at 7:41 PM
|
wtsnzTotal Posts: 74
Joined: September 11, 2011
|
Re: Pixel Perfect Collision DetectionI'm just trying to re-create what I had before I re-wrote all of this code actually, And I can't seem to do it. I had buried my image within 2 sprites to get what I needed, or something..
Posted on October 14, 2011 at 7:44 PM
|
levelbylevelTotal Posts: 35
Joined: September 14, 2011
|
Re: Pixel Perfect Collision DetectionI've drawn a rubbish diagram to show what I need. If anyone knows any high-school level maths to help me, id well appreciate it, lol
Posted on October 14, 2011 at 7:53 PM
|
wtsnzTotal Posts: 74
Joined: September 11, 2011
|
Re: Pixel Perfect Collision DetectionI found this for you on stackoverflowhttp://stackoverflow.com/questions/6657479/aabb-of-rotated-sprite...
Posted on October 14, 2011 at 7:58 PM
|
levelbylevelTotal Posts: 35
Joined: September 14, 2011
|
Re: Pixel Perfect Collision DetectionThat is infact gold:
Posted on October 14, 2011 at 9:18 PM
|
wtsnzTotal Posts: 74
Joined: September 11, 2011
|
Re: Pixel Perfect Collision DetectionI've tried the class you linked too above and it work-ish, Like you said, the collision detection is off on cpp targets (by quite a lot!)
Posted on October 17, 2011 at 8:20 PM
|
