开发者

How to check collision in a drawn curve, instead of the Sprite's bound box

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 id开发者_JAVA百科ea?


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜