Help on how to move object long distance to specific height
|
|
Andie Convair
Registered User
Join date: 11 Mar 2008
Posts: 7
|
09-26-2008 21:11
I'm working on a script where you select a height to move the target prim to via Dialog. I adapted the open source long distance teleport script to allow me to do this, but the problem with that is it requires you to enter the target location as a predefined vector variable. I'm looking for a way to tell the script to move the prim to say Z - 300m in height but not move it's position on the X or Y lines. For instance, the prim's position is <210.315,54.457,112.329> and via the dialog menu you choose to move it to 300m. I get the prim's current position on rez with vector gStartPos=<0,0,0>; and define the target position with vector gTargetPos3 = ???; but how do I go from there to tell it to add the however many meters it takes to the Z line, to make it 300m? I'd appreciate any help that could be offered, thanks in advance.
|
|
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
|
09-26-2008 23:19
float desiredz = 3000; // your desired z value
vector pos;
pos = llGetPos() ;
//change the z value of pos to the desired z value
pos.z = desiredz ;
_____________________
-
So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.
I can be found on the web by searching for "SuezanneC Baskerville", or go to
http://www.google.com/profiles/suezanne
-
http://lindenlab.tribe.net/ created on 11/19/03.
Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard, Robin, and Ryan
-
|
|
Andie Convair
Registered User
Join date: 11 Mar 2008
Posts: 7
|
09-26-2008 23:40
Alright, I understand what you posted but not how to apply it, if that make sense? This is the part of the script that applies to what I'm stuck on. Where do I add the pos.z and desiredz in at? I've been doing pretty good on scripting so far with SL or at least adapting open source scripts but this has me kind of floundering. vector gTargetPos3 = <???>; vector gTargetPos4 = <???>; vector gTargetPos5 = <???>; vector gTargetPos6 = <???>; vector gTargetPos7 = <???>; integer myChannel = 9844; vector gStartPos=<0,0,0>; key gAvatarID=NULL_KEY; integer gReturnToStartPos=FALSE; warpPos( vector destpos) { integer jumps = (integer)(llVecDist(destpos, llGetPos()) / 10.0) + 1;
if (jumps > 100 ) jumps = 100; list rules = [ PRIM_POSITION, destpos ]; integer count = 1; while ( ( count = count << 1 ) < jumps) rules = (rules=[]) + rules + rules; llSetPrimitiveParams( rules + llList2List( rules, (count - jumps) << 1, count) ); }
//--------- //(the function used when dialog option chosen to select destination height) if(message=="300") { warpPos(gTargetPos3); return; }
From: SuezanneC Baskerville float desiredz = 3000; // your desired z value vector pos; pos = llGetPos() ; //change the z value of pos to the desired z value pos.z = desiredz ;
|
|
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
|
09-27-2008 00:03
I don't see how "vector gStartPos=<0,0,0>;" gets the current position of anything. If your dialog box is producing a string variable called message, which is a string version of the desired z value, then I think you could do something like vector currentpos; currentpos=llGetPos(); warpPos( < currentpos.x, currentpos.y, (float) message>  ; I hope a good scripter comes along soon.
_____________________
-
So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.
I can be found on the web by searching for "SuezanneC Baskerville", or go to
http://www.google.com/profiles/suezanne
-
http://lindenlab.tribe.net/ created on 11/19/03.
Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard, Robin, and Ryan
-
|
|
Andie Convair
Registered User
Join date: 11 Mar 2008
Posts: 7
|
09-27-2008 00:11
Ahhh, no, sorry, I left out the part under state entry that I was using to get pos.. gStartPos = llGetPos();But that worked perfectly, thank you very much!
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
09-27-2008 06:25
Compile this script under MONO and you can change the following: warpPos( vector destpos) { integer jumps = (integer)(llVecDist(destpos, llGetPos()) / 10.0) + 1;
if (jumps > 100 ) jumps = 100; list rules = [ PRIM_POSITION, destpos ]; integer count = 1; while ( ( count = count << 1 ) < jumps) rules = (rules=[]) + rules + rules; llSetPrimitiveParams( rules + llList2List( rules, (count - jumps) << 1, count) );
to warpPos( vector destpos) { integer jumps = (integer)(llVecDist(destpos, llGetPos()) / 10.0) + 1;
if (jumps > 412 ) jumps = 412; list rules = [ PRIM_POSITION, destpos ]; integer count = 1; while ( ( count = count << 1 ) < jumps) rules += rules; llSetPrimitiveParams( rules + llList2List( rules, (count - jumps) << 1, count) ); The change will allow you to go to the new max build height of 4096 meters.
_____________________
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
|