views:

26

answers:

1

There are two Sprite's hit tests, one check the object (and have no precision on the curves) and the other check a specified (x, y) point. But, having curves drawn using Graphics.curveTo(), how do I check if 2 drawn curves are colliding?

I'm not sure if this is an actionscript or a math problem... I want to check all (x,y) of a curve to all (x,y) of the other curve..

any idea?

A: 

Bezier curve intersections are a little tricky to calculate, but take a look at ActionSnippet - Bezier Intersections (not a snippet), By Zevan. There are some useful functions, and a working example just under the code.

A better way to do collision detection (in my opinion) would be the method described here: Skinner collision detection in AS3. A full collision detection library has been made here that seems to work really well: Collision Detection Kit (AS3).

TandemAdam
Cool.. I was reading about the Bezier before, but the already done Collision Detection Kit seems perfect.. :)
Tom Brito