Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Move to target -- stumped

Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
03-30-2008 22:35
maybe just brain fried.

making a cable car that can go up on a slant -- so forwards, and up (and vice versa.)

So I figgered llMoveToTarget would do the trick.

But it won't get started even. It tries to but can't move (nope, it's not stuck, I checked many times.) It's 27 prim. Lindomass reports as 288 whatevers, though I understand this doesn't really have any relation here.

Here's bits of the code; it's a mess, i just grabbed bits out for the pieces related to this question. And it's all just an initial rough proof of concept sketch, thus hard coded and everything in places.

float speed = 0.05;
float precision = 0.5;
vector CurrentPos;
float range = 0.1;
vector start_pos;
integer TargetID;
vector TargetVector;

stop() {
llTargetRemove(TargetID);
llSetTimerEvent(0);
llStopMoveToTarget();
llShout(0,"ARRIVED";);
llSetStatus(STATUS_PHYSICS, FALSE);
llSetPos(TargetVector);
}


default {
state_entry() {
llSetStatus (STATUS_ROTATE_X|STATUS_ROTATE_Y|STATUS_ROTATE_Z, FALSE);
start_pos= <45.72342, 161.76523, 522.06458>;
llListen(0,"","","";);
}

listen(integer a, string n, key id, string msg) {
if (msg == "go";) {
TargetVector= <87.41540, 161.78163, 544.55786>;
TargetID = llTarget(TargetVector, range );
llSetStatus(STATUS_PHYSICS,TRUE);
llSetTimerEvent(.5);
}
}

timer() {
CurrentPos = llGetPos();
llMoveToTarget(TargetVector,speed);
if ( (CurrentPos == TargetVector) ){
stop();
}

}

at_target( integer number, vector targetpos, vector ourpos ) {
stop();
}

}
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
03-31-2008 00:39
IIRC llMoveToTarget() will do nothing if the target is not within 50m or the damping period is less than something like 0.2. It looks like you are JUST within the 50m, but the damping coefficient is only 0.05 (which is a pretty darn quick trip anyway; traveling approx. 2/3 of 50m in 0.05 seconds is like 600 m/s). You may want to try increasing the damping period a bit.
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
03-31-2008 10:46
Also, how big is your object, llMoveToTarget craps out after a bit if the object has too much mass.
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
03-31-2008 10:52
Yes, movetotarget is not suitable for use with anything of significant size and lifespan; it runs out of energy quickly. Use vehicle functions, which don't run out of energy at all (or nonphysical movement I suppose).
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!

http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal

http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
03-31-2008 11:14
From: Johan Laurasia
Also, how big is your object, llMoveToTarget craps out after a bit if the object has too much mass.


How big? I covered that in my first posting. I probably should have broke the text out into less of a ramble:

From: Chaz Longstaff
It's 27 prim. Lindomass reports as 288 whatevers....
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
03-31-2008 15:41
From: Ordinal Malaprop
Yes, movetotarget is not suitable for use with anything of significant size and lifespan; it runs out of energy quickly. Use vehicle functions, which don't run out of energy at all (or nonphysical movement I suppose).


What kind of vehicle type would you recommend for a cable car?
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
03-31-2008 16:22
From: Chaz Longstaff
What kind of vehicle type would you recommend for a cable car?

It doesn't matter all that much given that you will have to alter the parameters a lot anyway, but probably VEHICLE_TYPE_BALLOON.
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!

http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal

http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
03-31-2008 20:03
hehe, sounds like fun, I'll give it a go :}

Up, up and away, in my beautiful... gondola ???

Worth it see to the look on the passengers' faces :} grin.