clox
07-02-2008, 02:07 AM
Okay, I don't know how to explain this but ill try...
I need this to work for a project that im programming in flash
I have a line with a specified length, going from a specified base-point
this line rotates so that it always points at the mouse-cursor.
but if the distance between its base-point and the mouse-cursor is less than the line-length, I want to curve the line, with a specified amount of segments, so that its end-point is equal to the mouse-point.
I don't know how to do the curve effect properly though.
I tried letting the total curvature of the line be PI*2 radians(360 degrees) if the distance is 0, and 0 if the distance is greater than the length, and have a constant change between that
that of course, wouldnt produce the correct result, the line-end-point and the mouse-point are only equal when the distance is zero or equal to the lineLength.
The distance from the end point to the initial point shouldn't change at a constant rate. It's a trigonometric issue someone told me.
this flash demonstrates it, and you might get a better idea of what I'm after.
http://img80.imageshack.us/my.php?image=curvelineie1.swf
I heard the entire arc in radians should be the
arc cosine of(distance / lineLength) * 2
this produced a better result but thats still not it.
you can see that here:
http://img157.imageshack.us/my.php?image=cloxcurvetoty2.swf
I really hope someone here can help me with this.
I would *really* appreciate it.
Any comments or small help is welcome, and if there's anything else i need to specify to make it easier for you to help me then just tell me..
Thanks in advance!
I need this to work for a project that im programming in flash
I have a line with a specified length, going from a specified base-point
this line rotates so that it always points at the mouse-cursor.
but if the distance between its base-point and the mouse-cursor is less than the line-length, I want to curve the line, with a specified amount of segments, so that its end-point is equal to the mouse-point.
I don't know how to do the curve effect properly though.
I tried letting the total curvature of the line be PI*2 radians(360 degrees) if the distance is 0, and 0 if the distance is greater than the length, and have a constant change between that
that of course, wouldnt produce the correct result, the line-end-point and the mouse-point are only equal when the distance is zero or equal to the lineLength.
The distance from the end point to the initial point shouldn't change at a constant rate. It's a trigonometric issue someone told me.
this flash demonstrates it, and you might get a better idea of what I'm after.
http://img80.imageshack.us/my.php?image=curvelineie1.swf
I heard the entire arc in radians should be the
arc cosine of(distance / lineLength) * 2
this produced a better result but thats still not it.
you can see that here:
http://img157.imageshack.us/my.php?image=cloxcurvetoty2.swf
I really hope someone here can help me with this.
I would *really* appreciate it.
Any comments or small help is welcome, and if there's anything else i need to specify to make it easier for you to help me then just tell me..
Thanks in advance!