The Holy Grail of Flash

Posted by DesertFox on May 17, 2007, 3:03 p.m.

The Holy Grail of Flash

As any of you who have messed with Actionscript know, smooth collision detection is the Holy Grail of flash game developers.

Suprisingly enough, Flash only has bounding box collision detection, and no built-in smooth collision detection. Now, there are plugins or something that you can buy (I've only found 1 though), but they cost money.

It wouldn't have been very hard for the Flash Developers to code in advanced collision detection, but they didn't. So I did. Smooth, complex-polygon collision detection. It is pure awesomeness, and way better than the default hitTest() which uses bounding boxes only. I wrote this in just under 2 days, and I'll post the actionscript files if you want me to. This code can be used in any language (allowing for syntax changes) like C++, for game development and complex-polygon collision detection.

Its fricken sweet. If you don't think it's fricken sweet, go make your own smooth collision detection in 2 days. From scratch. Remember, Flash doesn't even have built-in line-segment intersection code.

*may take a few seconds to load

*to see the new version, clear your cache!

<p align=center><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="550" height="400" id="Collider" align="middle">

<param name="allowScriptAccess" value="sameDomain" />

<param name="movie" value="Collider.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="http://64digits.com/users/DesertFox/Collider.swf" quality="high" bgcolor="#ffffff" width="550" height="400" name="Collider" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

</object></p>

And I invoke [url=http://en.wikipedia.org/wiki/Godwin's_Law]Godwin's Law

<p align=center>*cough*Hitler*cough*<br><br>*cough*Watermelons*cough*</p>

Comments

JoshDreamland 17 years, 5 months ago

Cat, don't be dumb. Seriously. Line-line intersection? THINK. 'k?

How efficient would that be? He gave you a fucking example, and offered the code. Give what you think you're going to say just a little bit of thought before flaming.

sirxemic 17 years, 5 months ago

I was joking. I was fucking joking. Of course I trust him it's polygon-intersection. I was just joking because in his example the shapes had such sizes you could say it is line-line intersection.

Well done BTW XD

DesertFox 17 years, 5 months ago

You confused the heck out of me Cat - I didn't know who you were cause of the namechange..

Dragonos 17 years, 5 months ago

tis why this name change thing is quite funny.

(Thinks about new user name)

s 17 years, 5 months ago

Collision detection rules.Does it include shapes with holes in the middle?

poultry 17 years, 5 months ago

omgserpexpwn

DesertFox 17 years, 5 months ago

@serprex - yes. It does. Pwn!

Gamer3D 17 years, 5 months ago

I wrote one based on the <a href="http://en.wikipedia.org/wiki/Separating_axis_theorem">Separating Axis Theorem</a>. Yours will not load, so I can't test it, but mine was made so it would give me a vector that would move one shape out of the other. It, however, required a convex polygon in order to not give false positives.

chiggerfruit 17 years, 5 months ago

Sorry man, but they're not doctored. =

These are the only two cases between any of the shapes that i could find an error with.

s 17 years, 5 months ago

Wouldn't it be nice if ppl just posted links instead of the actual images?