Move non physical SLOWLY and SMOOTHLY
|
|
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
|
07-01-2006 13:53
Hi all... there seem to be lots of ways to move things... I want to move a large door veeeeery sloooooowly... just sliding it sideways like a giant vault or something... taking several seconds to slide over... but I want it to be very smooth...
What is the right technique for this kind of thing?
THanks so much
-Ryder-
|
|
Charles Granville
Registered User
Join date: 18 Mar 2006
Posts: 33
|
07-01-2006 14:05
I would use llMoveToTarget.
|
|
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
|
07-01-2006 15:08
Charles... llMoveToTarget specifically says that it is for physical objects.
I'm looking for a method for a NON physical object.
Are you saying that llMoveToTarget works on non physical objects too?
Ryder
|
|
Zapoteth Zaius
Is back
Join date: 14 Feb 2004
Posts: 5,634
|
07-01-2006 15:15
_____________________
I have the right to remain silent. Anything I say will be misquoted and used against me.--------------- Zapoteth Designs, Temotu (100,50)--------------- 
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
07-01-2006 15:19
using set pos with tiny steps in a loop will make things move slowly and smoothly, the magic trick is making it move quick and smooth 
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
07-01-2006 15:20
The key with using llSetPos for smooth movement is to use several different subscripts, each moving the object a tiny little way. You have to do this because each call of llSetPos incurs a 0.2 second sleep, so just from one script you can't get smooth movement.
What you want to do is have a main script with a timer, that sends link messages to each of the subscripts in turn telling them to move the door (or whatever it is). You need as many subscripts as (0.2 / your timer interval), probably + 1 to account for delays caused by any calculations you need to make. So if you have a timer going every 0.05 seconds you should put in 5 subscripts.
All the subscripts need to have in them is a link_message() event.
It's quite hard to get it looking good to be honest, and it requires some tinkering with the parameters. The speed and timer interval will look better with some values in some sims than in other sims or with other values.
|
|
Rifkin Habsburg
Registered User
Join date: 17 Nov 2005
Posts: 113
|
07-01-2006 15:35
Is there a particular reason why it has to be non-physical?
I have objects that are non-physical 99% of the time, but when I want them to move smoothly, I use llSetStatus(STATUS_PHYSICS | STATUS_PHANTOM, TRUE), then llMoveToTarget(), and then make it non-physical again.
Having a very fast timer, or sub-scripts doing llSetPos(), is much more stressful on the server than a single physical, phantom obejct.
_____________________
Procyon Games: makers of Can't Stop, En Garde, Take it Easy, Danger Zone and Frootcake.
|
|
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
|
07-01-2006 15:59
Mmmm.... so physical, turn on phantom so that it won't bounce in some unexpected way... then ||MoveToTarget. I'm so friggin new at this that everything is painful  I just tried the llSetPos, and as I expected, anything *but* smooth... jerk, jerk, jerk... Why can't there be a function where you give two positions, and a time to get from one to the other? I guess maybe that is what movetotarget is... THanks.... giving it a try. From: Rifkin Habsburg Is there a particular reason why it has to be non-physical?
I have objects that are non-physical 99% of the time, but when I want them to move smoothly, I use llSetStatus(STATUS_PHYSICS | STATUS_PHANTOM, TRUE), then llMoveToTarget(), and then make it non-physical again.
Having a very fast timer, or sub-scripts doing llSetPos(), is much more stressful on the server than a single physical, phantom obejct.
|
|
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
|
07-01-2006 16:15
Not working... my door goes shooting into the sky! (when touched): ------------------------------- llSetStatus(STATUS_PHYSICS | STATUS_PHANTOM, TRUE); // destination is ten meters above our current position vector destination = llGetPos() + <0, 0, 10>; // Start moving towards the destination llMoveToTarget( destination, 10 ); llSetStatus(STATUS_PHYSICS | STATUS_PHANTOM, FALSE); ------------------------------ help  BTW... how does everyone get their code text to go into that cool little window in their messages?
|
|
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
|
07-01-2006 17:09
From: Ryder Spearmann Not working... my door goes shooting into the sky! help  You need to manually stop the movement when your object reaches destination and triggers relevant event. See: http://secondlife.com/badgeo/wakka.php?wakka=llMoveToTargetFrom: someone BTW... how does everyone get their code text to go into that cool little window in their messages? use [ php ] [ /php ] tags (without spaces)
|
|
Charles Granville
Registered User
Join date: 18 Mar 2006
Posts: 33
|
07-01-2006 17:09
Ah, sorry... was thinking of how llLookAt works for both, as I have been working with it a lot lately.
|
|
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
|
07-01-2006 17:11
GAH!!!!
This is *****REALLY**** gettying annoying...
my door now simply falls over... it goes physical... than slowly sinks and twists into the ground.
This is so friggin stupid....!
I just want to move a single prim, from where it is, to 2 meters down a single axis, in n seconds.
Why does this have to be so hard?
Now I have multiple copies of my door... polluting my land... sunk beneath the surface... where I can't get at them...
I'm dumbfounded.
|
|
Charles Granville
Registered User
Join date: 18 Mar 2006
Posts: 33
|
07-01-2006 17:13
Press control-alt-shift-5 to toggle rendering of the ground.
(you might need debug on, it's control-alt-shift-D.)
|
|
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
|
07-01-2006 17:14
My stupid code thus far: integer targetID;
default {
touch_start(integer total_number) { llSetStatus(STATUS_PHYSICS | STATUS_PHANTOM, TRUE); // destination is ten meters above our current position vector destination = llGetPos() + <0, 0, -1.5>;
// how close is close enough float range = 0.1;
// Ask to be informed whether we're there or not targetID = llTarget( destination, range );
// Start moving towards the destination llMoveToTarget( destination, 10 ); }
not_at_target() { // We're not there yet. llWhisper(0, "Still going"); }
at_target( integer number, vector targetpos, vector ourpos ) { llSay(0, "We've arrived!");
// Stop notifications of being there or not llTargetRemove(targetID);
// Stop moving towards the destination llStopMoveToTarget();
// Become non-physical llSetStatus(STATUS_PHYSICS | STATUS_PHANTOM, FALSE); }
}
|
|
Zapoteth Zaius
Is back
Join date: 14 Feb 2004
Posts: 5,634
|
07-01-2006 17:14
From: Ryder Spearmann GAH!!!!
This is *****REALLY**** gettying annoying...
my door now simply falls over... it goes physical... than slowly sinks and twists into the ground.
This is so friggin stupid....!
I just want to move a single prim, from where it is, to 2 meters down a single axis, in n seconds.
Why does this have to be so hard?
Now I have multiple copies of my door... polluting my land... sunk beneath the surface... where I can't get at them...
I'm dumbfounded. You could try asking LiveHelp if there are any scripters around who'd be willing to help. At the least they should be able to tell you how to turn off surface patch rendering (the ground) so you can see and get at the doors underneath the ground. Can't remember off the top of my head. In World> Help Menu> LiveHelp. Be patient, can get very busy and there aren't always people around.
_____________________
I have the right to remain silent. Anything I say will be misquoted and used against me.--------------- Zapoteth Designs, Temotu (100,50)--------------- 
|
|
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
|
07-01-2006 17:15
From: Charles Granville Press control-alt-shift-5 to toggle rendering of the ground.
(you might need debug on, it's control-alt-shift-D.) Wow.... thanks so much Charles... this is a really great tip. It's the bright spot of my day  Ryder
|
|
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
|
07-01-2006 17:35
If you'd like someone to step you through things, I would recommend you check the ScriptingMentors page on the wiki. (There's a link in my signature)
|
|
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
|
07-03-2006 08:55
Hi all.... the saga of the garage door continues....  I have a reliable door... that moves between two poistions (thx hamncheese) But the behavior is very odd It is a vertical garage door... and is non-physical. to move, it is made phantom, as well as physical... then llMoveToTarget is used. Oddly... the door seems to shift to the side... then recover... then shift inward and more or less scooch around off the movement axis as it makes it's way to it's destination. It does not move smoothly on axis... and I wonder if the wind is affecting the object or something (because its wanderings are irregular... and sometimes seems to operate well) What might this be? Thx all.
|
|
Dominic Webb
Differential Engineer
Join date: 1 Feb 2006
Posts: 73
|
07-03-2006 10:15
Look into the llSetStatus() options involving not allowing rotation, etc. I used this when creating my steam-powered butlerso it can only rotate around the Z axis, despite being STATUS_PHYSICS). llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z, FALSE); - d.
_____________________
.sig space for rent.
|
|
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
|
07-03-2006 10:25
Thanks... there doesn't seem to be a way to lock anything except rotation. All translation (where my problem resides) are still free to move... unless I am missing something thx. From: Dominic Webb Look into the llSetStatus() options involving not allowing rotation, etc. I used this when creating my steam-powered butlerso it can only rotate around the Z axis, despite being STATUS_PHYSICS). llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z, FALSE); - d.
|
|
Hamncheese Omlet
what's for breakfast?
Join date: 2 Apr 2006
Posts: 79
|
Hey Ryder...
07-03-2006 11:20
From: Ryder Spearmann Thanks... there doesn't seem to be a way to lock anything except rotation. All translation (where my problem resides) are still free to move... unless I am missing something thx. I'm going to try some things today to see why it is doing that and will catch up with you in game. But I have another idea if this doesn't work. Your door isn't visible when open and in fact, disappears into the mountain. Instead of trying to counter physics, why not shrink the door to look like it is opening? The door stays in position, but shrinks to one side. The llSetPrimitiveParams can be called in a chain of PRIM_SIZE calls which could similate the effect you are looking for. From: Dominic Webb Look into the llSetStatus() options involving not allowing rotation, etc. I used this when creating my steam-powered butlerso it can only rotate around the Z axis, despite being STATUS_PHYSICS). llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z, FALSE);
I'm not in the game right now, but I think this code is in there. The script was pulled from a fixed Sliding Steel door (one of the bouncer doors a Linden made) and then Ryder modified for his door.
|
|
Dominic Webb
Differential Engineer
Join date: 1 Feb 2006
Posts: 73
|
07-28-2006 14:53
From: Ryder Spearmann Thanks... there doesn't seem to be a way to lock anything except rotation. All translation (where my problem resides) are still free to move... unless I am missing something thx. I would strongly suggest using the Timeless Linked Door script: http://secondlife.com/badgeo/wakka.php?wakka=LibraryTimelessLinkedDoorIt pretty much is the ultimate door-script killer. - d.
_____________________
.sig space for rent.
|