Thanks Paul - that looks awesome and just what I need

-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Paul Andrews
Sent: 16 June 2011 14:48
To: Flash Coders List
Subject: Re: [Flashcoders] Detecting if line crosses movie clip

On 16/06/2011 13:58, Paul Steven wrote:
> Working on a game where the player must draw around some colored balls on
> screen by dragging the mouse to create the polygon that surrounds the
> objects.
>
> The polygon is created by drawing a series of lines every time the mouse
> moves. If one of these lines intersects one of the balls (movie clip) I
need
> to perform an action.
>
> So my question is how to detect when the line intersects a movie clip?
>
> The following is unsuitable as it treats the line as a rectangle e.g a
> vertical line will have a lot of hit area that I do not want to be hit
area
>
> if (ballMC.hitTestObject(lineMC)) {
>
> My other best suggestion is to use the 4 lines that make up the bounding
box
> of the ball movie clip and do a line intersection test for each line
against
> the line being drawn. This seems overly complex so before I try this I
> wanted to check there is not a simpler solution.

http://keith-hair.net/blog/2008/08/05/line-to-circle-intersection-data/




> Thanks in advance
>
>
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to