Elevator Woes
|
Zen Mechanique
Registered User
Join date: 31 Mar 2005
Posts: 4
|
05-17-2005 20:25
Hello all, I have an elevator problem.
I have some less than lovely neighbors (the buildings, the neighbors themselves are probably fine) and so have been forced to build my home at some altitude, sadly at an altitude far beyond the llmovetotarget limit of about 60m. I have tried moving it in small bursts hoping it would be able to go higher but to no avail.
Is there an elegant solution to this issue other than lowering my build using a teleporter, or just giving up and flying?
-Zen Mechanique
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
05-17-2005 22:22
This is kind of extreme, but to reduce complexity, I would deligate the moving duties to another script. // Note: check my math in this function. Im pretty sure its right. vector setVectorDistance(vector destination, float distance) { if (llVecDist(llGetPos(), destination) < distance) { return destination; } else { // Argh, we actually have to do math. vector offset = destination - llGetPos(); return llVecNorm(offset) * distance + llGetPos(); } }
// llMoveToTarget's distance limit. float DIST_LIMIT = 50.0; // Don't make this too small. float TARGET_ACCURACY = 1.0;
vector curDest; float curTau; integer curTarg = -1;
default { link_message(integer sender, integer num, string parameters, key identifyer) { if (identifyer == "moveToTarget") { // Cancel the current move, if we are moving. if (curTarg != -1) llTargetRemove(curTarg); // Don't do anything if we're not physical if (!llGetStatus(STATUS_PHYSICS)) return; // Start a new move. list moveParams = llCSV2List(parameters); curDest = (vector) llList2String(moveParams, 0); curTau = (float) llList2String(moveParams, 1); curTarg = llTarget(curDest, TARGET_ACCURACY); // We might want to set the minimum time between events // with llMinEventDelay here, so not_at_target doesn't fire every half-second. llMoveToTarget(setVectorDistance(curDest, DIST_LIMIT), curTau); } } not_at_target() { llMoveToTarget(setVectorDistance(curDest, DIST_LIMIT), curTau); } at_target(integer targNum, vector targPos, vector curPos) { if (targNum == curTarg) llMoveToTarget(targPos, curTau); llTargetRemove(targNum); } }
Copy and paste the above into a script, and dump that into the moving object (your elevator). Then, instead of calling llMoveToTarget in your other script(s), use this: moveToTarget(vector dest, float tau) { llMessageLinked(LINK_THIS, 0, llList2CSV([dest, tau]), "moveToTarget"); }
This way, your other scripts dont have to deal with the nitty-gritty details of circumventing llMoveToTarget's limit. ==Chris
|
Shack Dougall
self become: Object new
Join date: 9 Aug 2004
Posts: 1,028
|
05-18-2005 02:16
llMoveToTarget will go to any height, but does have some limitations.
1) the distance limitation already mentioned -- can't move more than 64m in a single call. 2) physics must be enabled on the prim running the script 3) the prim must have have enough energy to move itself and anything on it.
This last one deserves some explanation.
It's possible to make a prim so heavy that it can't move itself. So if a physical script isn't moving, try it in a small prim such as the default cube first. Also, if an elevator has multiple prims, make sure that the largest prim has the movement script and that it is the root prim. a small prim will have trouble moving a larger prim on top of it or an avatar.
You might also try llSetPos. it won't move more than 10m in a single call, and it has an overall height limitation of 500m or 768m. But it is a lot less quirky than moveToTarget and easier on the sim, since it doesn't use physics.
_____________________
Prim Composer for 3dsMax -- complete offline builder for prims and sculpties in 3ds Max http://liferain.com/downloads/primcomposer/
Hierarchical Prim Archive (HPA) -- HPA is is a fully-documented, platform-independent specification for storing and transferring builds between Second Life-compatible platforms and tools. https://liferain.com/projects/hpa
|
Shack Dougall
self become: Object new
Join date: 9 Aug 2004
Posts: 1,028
|
05-18-2005 02:36
A couple more thoughts... If you haven't used physics before, I strongly suggest using a Lost Die script to kill the object if it gets away from you. Just be sure that you keep a copy of it, beforehand. Also, consider building at around 250m. This is a great height for several reasons. 1) you're above ground clutter. 2) it's below the 256m set home limit. So you can set your home position there. 3) it's above the clouds. Clouds can be annoying when they're moving through your build. Here's a Lost Die Script: //Title: Lost Die Script //Date: 10-30-2003 06:53 AM //Scripter: ZHugh Becquerel
float LastTimeOwnerDetected; key owner;
TellOwner( string Message ) { // llWhisper( 0, "Trace: " + Message ); llInstantMessage(owner, (string)llGetPos() + " " + Message ); }
Init() { owner = llGetOwner(); LastTimeOwnerDetected = llGetTimeOfDay(); llSetTimerEvent(10.0); llSensorRepeat( "", "", AGENT, 50, PI, 10.0 ); } SelfDestructNow() { llSay(0, "Too far from owner. Self-destructing..."); llInstantMessage(owner,"Too far from owner. Self-destructing..."); llDie(); }
default { state_entry() { Init(); } on_rez(integer start_param) { Init(); } timer() { if( llGetTimeOfDay() - LastTimeOwnerDetected > 60 ) { //TellOwner( (string)llGetTimeOfDay() + " " + (string)LastTimeOwnerDetected ); SelfDestructNow(); } else if( llGetTimeOfDay() - LastTimeOwnerDetected > 30 ) { TellOwner( "Self destructing in 30 seconds..." ); } } sensor(integer num_detected) { integer i; integer near_owner; near_owner = FALSE; for( i=0;i<num_detected;i++) { //TellOwner("Sensed:" + llDetectedName(i)); if( llDetectedKey(i) == owner) { //TellOwner( "You're close"); near_owner = TRUE; } } if( near_owner == TRUE ) { LastTimeOwnerDetected = llGetTimeOfDay(); } } }
_____________________
Prim Composer for 3dsMax -- complete offline builder for prims and sculpties in 3ds Max http://liferain.com/downloads/primcomposer/
Hierarchical Prim Archive (HPA) -- HPA is is a fully-documented, platform-independent specification for storing and transferring builds between Second Life-compatible platforms and tools. https://liferain.com/projects/hpa
|
Fox Stirling
Certified Lunatic
Join date: 16 Aug 2004
Posts: 120
|
05-19-2005 13:02
Hi Zen, I think I have a solution to your problem.. I recently built an elevator for a neighbor who has a skybox. I've since improved the script, adding some features to make it more drop and go friendly. It has no real height limit and it will get you to your destination fairly quick. The only problem is, its still in a beta format, and not really ready to be released into the wild. If you want, I'd be more than willing to help you get it all setup for your needs, just grab me in world at some point.
--Fox
|
Illykai Pussycat
Registered User
Join date: 16 Jun 2005
Posts: 2
|
07-27-2005 18:53
From: Shack Dougall You might also try llSetPos. it won't move more than 10m in a single call, and it has an overall height limitation of 500m or 768m. But it is a lot less quirky than moveToTarget and easier on the sim, since it doesn't use physics. I'm also building an elevator, but I'm finding that the weight of an avatar standing on the elevator platform prevents it from reaching the target that I've told it to go to with llMoveToTarget. I've experimented with llSetPos, but it seems to make the elevator platform move straight through avatars, even through phantom is not enabled on the object. Is this how it's meant to work?
|
Darkriver Parvenu
Second Life Resident
Join date: 20 Nov 2004
Posts: 2
|
07-27-2005 20:25
From: Illykai Pussycat I'm also building an elevator, but I'm finding that the weight of an avatar standing on the elevator platform prevents it from reaching the target that I've told it to go to with llMoveToTarget. I've experimented with llSetPos, but it seems to make the elevator platform move straight through avatars, even through phantom is not enabled on the object. Is this how it's meant to work? Yes, llSetPos is non-physical movement, so it moves through things. This can be both an advantage and an annoyance. If the avatar is sitting on the thing being moved by setPos, however, they will be moved, too. So llSetPos is good for elevators that have chairs or seats on them. With llMoveToTarget, the mass of the root prim of the elevator is important. It needs to be more massive than all of the avatars that are standing on it. So, you might try making it thicker. But of course, there's the flip side too. If you make it too heavy then, it won't move at all. So experiment. And moveToTarget can't move more than 64m in a single call. If you try to make it move farther than that, it damps to the current position. This is different from the llSetPos behavior which will simply move 10m towards the goal. Hope this helps. Post more details or followups if you need additional clarification.
|
Angus Kuhr
Dwarf with a Hammer
Join date: 17 Jul 2005
Posts: 43
|
08-04-2005 05:18
Well, this thread has certainly been handy...I've been trying to get elevators and lifts to work for days!
Another thing I've noticed: as soon as an AV walks onto a lift, it pushes it around, even if it is at the same level as the prim you walked onto it from.
That's just annoying.
|
Snakeye Plisskin
Registered User
Join date: 8 Apr 2005
Posts: 153
|
08-04-2005 10:13
I built a cool looking elevator based on one of the scripts in the forum script library. It looks realy cool, i'll put a pic up of it when i get back from work.
In order to not bump the elevator lift just put a sloped prim down before the elevator floor that is slightly higher than the elevator floor (make sure however that it does not obstruct it's path). This will have you drop on top of it rather than bumping into it.
|