|
Lemieux Primeau
Registered User
Join date: 25 Oct 2006
Posts: 49
|
11-02-2007 19:52
Can anyone provide the code (or something close that I can tweak) to find a point on a line between two points that is a certain distance from one of the points?
I need to use llMoveToTarget but the destination is greater than 60 meters. So I was going to do several 50 meter moves until I get there. But each time I will need a target that is 50 meters away on a line between me and the destination.
vector GetPoint(vector V1, vector V2, float fDistanceFromV1) { ??? }
//move 50 meters towards the destination in around 4 seconds... llMoveToTarget(GetPoint(llGetPos(), vDestination, 50), 4);
Any help would be appreciated!
|
|
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
|
11-02-2007 19:56
From: Lemieux Primeau Can anyone provide the code (or something close that I can tweak) to find a point on a line between two points that is a certain distance from one of the points?
I need to use llMoveToTarget but the destination is greater than 60 meters. So I was going to do several 50 meter moves until I get there. But each time I will need a target that is 50 meters away on a line between me and the destination.
vector GetPoint(vector V1, vector V2, float fDistanceFromV1) { return llGetPos() + llVecNorm(V2 - V1) * fDistanceFromV1; }
llMoveToTarget(GetPoint(llGetPos(), vDestination, 50), 4); ♪
|
|
Lemieux Primeau
Registered User
Join date: 25 Oct 2006
Posts: 49
|
11-02-2007 20:23
Whoa, thanks alot Tyken 
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
11-02-2007 20:43
if you are facing the point llMoveToTarget( llGetPos() + <.0, 50.0, .0> * llGetRot(), 4 ); 50m in the objects local +y direction including looking down/up
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|