Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

MoveToTarget doesn't work beyond X meters?

Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
08-27-2009 19:01
I've got a script that when you give my object a target, it turns and looks at the target, then chases them. However it seems like beyond 50 meters out or so, it only turns to face the target, doesn't chase them. Anyone have any idea why this might be?

EDIT: Apparently llMoveToTarget has a limit of 60 meters. And I'm told there's a way to have the script do the math and do 50 meter jumps. But I have no idea how that might be.

CODE


integer listen_chan = -231239;
string owner_name = "VTOL";

vector offset = < -1, 0, 3>; //Location

default{
state_entry(){
llSetBuoyancy(1);
llListen(listen_chan, "VTOLHUD", "", "");
llSetObjectName(owner_name);
}
listen(integer channel, string name, key speaker, string message){
// llSay(0,"heard message ("+message+")");
if(!llSubStringIndex(message,"target")){
string target=llGetSubString(message,7,-1);
// llSay(0,"targetting ("+target+")...");
llSensorRepeat(target, NULL_KEY, AGENT | ACTIVE | PASSIVE, 96.0, PI, 0.5);
}
}
sensor(integer x){
// llSay(0,"target found");
vector them = llDetectedPos( 0 );
vector me = llGetPos();
llLookAt( < them.x, them.y, me.z >, 0.5, 0.5 );
llMoveToTarget( llDetectedPos(0) + offset * llDetectedRot(0) ,0.4);
}
no_sensor(){
// llSay(0,"target not found");
llSensorRemove();
}
}

_____________________
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
08-27-2009 19:18
http://lslwiki.net/lslwiki/wakka.php?wakka=llMoveToTarget

If the target is too far away, as in 60 or so meters, use the work around in the wiki or use llApplyImpulse or llSetForce when you call llMoveToTarget and in the not_at_target event.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
08-27-2009 19:26
From: Jesse Barnett
http://lslwiki.net/lslwiki/wakka.php?wakka=llMoveToTarget

If the target is too far away, as in 60 or so meters, use the work around in the wiki or use llApplyImpulse or llSetForce when you call llMoveToTarget and in the not_at_target event.


I read that and it makes some sense to me, but every time I try to work it into my script, I get syntax errors.
_____________________