|
Kaylan Draken
Registered User
Join date: 2 Dec 2006
Posts: 127
|
11-23-2008 06:36
Hi all,
I build a elevator using llTarget, llMoveToTarget, at_target and llSetStatus. Only when the elevator moves up or down the elevator is Physical.
Script and elevator works fine so long there are not more than 2 person's on the elevator. With 3 or more the elevator moves up but never (or at least a very long time) the next floor.
Does anyone know how to solve this ?
thanx, Kaylan
|
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
11-23-2008 07:07
In this country there is always a sign in elevators saying how many people are allowed in it  You should adopt that for your elevator  Anyway, when it is physical it is attacked by all kind of forces, first of all gravity. This means you must use more power to overcome gravity for heavier items. To overcome gravity for the elevator itself you can use: llSetBuoyancy. Or you can apply a force: llSetForce(mass * <0, 0, 9.81>, FALSE); where mass is the total mass of elevator and people on it.
_____________________
From Studio Dora
|
|
Kaylan Draken
Registered User
Join date: 2 Dec 2006
Posts: 127
|
11-23-2008 07:18
Thanks Dora, I will try it  ) I tough that with llMoveToTarget the object would move to the target undepended from the weight of the object and whats on it. But looks like i am wrong and have to use a extra force to move it  )
|
|
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
|
11-25-2008 01:10
From: Kaylan Draken Thanks Dora, I will try it  ) I tough that with llMoveToTarget the object would move to the target undepended from the weight of the object and whats on it. But looks like i am wrong and have to use a extra force to move it  ) Nope, llMoveToTarget() works on physical objects, so if you overload the elevator with too much mass (avatars have mass), then it will eventually start to bog your elevator down. You can make a non physical elevator using the freely available warpPos() function... warpPos( vector d ) //R&D by Keknehv Psaltery, ~05/25/2006 { integer iterations; vector curpos; if ( d.z < (llGround(d-llGetPos())+0.01)) d.z = llGround(d-llGetPos())+0.01; //Avoid object getting stuck at destination if ( d.z > 4096 ) //Object doesn't get stuck on ceiling as of 1.18.5 (3), and with d.z = 4096; //havok 4 the height limit is increasing to 1024m.
//Hack added by Felixe Thorne curpos=llGetPos(); llSetPrimitiveParams([PRIM_POSITION, <1.84e+19, 1.84e+19, 1.84e+19>, PRIM_POSITION, d]); if (llGetPos()==curpos) { //Looks like it's been fixed, resort to the old method.. do //This will ensure the code still works.. albeit slowly.. if LL remove this trick (which they have done and reverted in the past..) { iterations++; integer s = (integer)(llVecMag(d-llGetPos())/10)+1; //The number of jumps necessary if ( s > 100 ) //Try and avoid stack/heap collisions with far away destinations s = 100; // 1km should be plenty integer e = (integer)( llLog( s ) / llLog( 2 ) ); //Solve '2^n=s' list rules = [ PRIM_POSITION, d ]; //The start for the rules list integer i; for ( i = 0 ; i < e ; ++i ) //Start expanding the list rules += rules; integer r = s - (integer)llPow( 2, e ); if ( r > 0 ) //Finish it up rules += llList2List( rules, 0, r * 2 + 1 ); llSetPrimitiveParams( rules ); curpos=llGetPos(); if (iterations>100) { d=curpos; //We're going nowhere fast, so bug out of the loop } } while (llVecDist(curpos,d) > 0.2); } }
call the function with the destination vector as such... vector destination = <1,2,3>; warpPos(destination);
that will work with a phone booth packed full of avatars 
_____________________
My tutes http://www.youtube.com/johanlaurasia
|
|
Kaylan Draken
Registered User
Join date: 2 Dec 2006
Posts: 127
|
11-26-2008 09:53
Thanks Johan, Thought WarpPos can only be used as teleport system not for moving a elevator slowly up and down? I solved it another way. When i move up or down with movetotarget i also activate llSetBuoyancy (0.8 or 1.2). thats enough to move more avatars up and down. but thanks for your sugestion 
|
|
Aztral Aeon
Registered User
Join date: 22 Dec 2007
Posts: 34
|
04-11-2009 10:42
Hey there.
I also built the same kind of physical elevator. Bouyancy will work, but you may want to consider another solution if you want to move people very far (like up to 4k) in a reasonable amount of time.
What I did was use llTarget, then in not_at_target() I apply an impulse based on how fast the elevator is moving. The max speed my elevator can go without losing passengers is around 50m/s so I adjust the impulse to keep elevator below that speed. Also, you'll want to start off slow, and end slow (if you immediately stop from 50m/s your passengers go flying out) so do a check like if the distance to your destination is < 300m slow to 30m/s, < 100m slow to 10m/s.
Lastly, passengers could potentially push your elevator so you may to check your x/y position everytime in not_at_target and apply another impulse to keep the elevator centered.
Anywayz, although this way is more complicated - it is more of general solution.
|