Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

smooth non-physical movement

Thanto Usitnov
Lord Byron wannabe
Join date: 4 Aug 2006
Posts: 68
09-13-2006 00:48
I finally figured out how to get a non-physical object to be moved via controls when sat on, but the motion is jerky, regardless of the movement distance I try. Is there any way to make non-physical movement smooth?
Ayrn Wake
Registered User
Join date: 7 Jan 2006
Posts: 39
09-13-2006 01:21
The commands used for nonphys movement delay the script execution, and thus you not only get jerky movement, but if the scripts doing anything else... well... it waits.

The solution is to use multiple scripts, a controller that takes the input, and a collection of movement scripts that the controller will cycle through as it sends commands. Passing the commands can be done in a variety of ways, from setting alpha and colour in prims, to link messages, to setting object names and descriptions.

Aaanyways, it basically works like this (using link message as the method):
1 Controller
x Movement Scripts (each with a name like Move 1, Move 2, etc)

On pressing forward, send a link message with a different number (as well as command stuff) each time, looping round when it reaches the max (x). So if you have five moment scripts, it'll send 1, 2, 3, 4, 5, 1, 2.... etc. Then you get the scripts to compare to their names (or values set inside them, whatever) the value that was sent by the link message, to signify its their turn at moving.

Aaaanyways, thats one method of handling it. Theres sooooo many though, and thats by far not the most efficient, just perhaps one of the easier ones to comprehend. Similar things work with IMs btw, or any other thing that might be throttled (bar httprequest and email I think, they're limited to the object and not script).
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
09-13-2006 03:28
Is there any way to get nonphys movement that's as smooth as phys movement, though? No. Not that I've found anyway. No matter how much you tinker with timers and link messages it's never quite as nice, which is a shame. (Actually I'd prefer it simply if phys vehicles were more reliable - or, even, if you could have people sitting on a phantom phys vehicle.)
Harris Hare
Second Life Resident
Join date: 5 Nov 2004
Posts: 301
09-13-2006 07:46
It's important to note that when you move a non-physical object using llSetPos(), you are really micro-teleporting the object to a new position. The fact that the object appears to "slide" into the new position is mearly a client-side effect and is separate from the simulator's phyics engine.

Physical objects on the other hand have a "dampening" attribute that the physics engine uses to control the objects motion, giving it a realistic smooth movement. This motion is actually performed and calculated on the server.
Maklin Deckard
Disillusioned
Join date: 9 Apr 2005
Posts: 459
09-13-2006 08:21
From: Ordinal Malaprop
Is there any way to get nonphys movement that's as smooth as phys movement, though? No. Not that I've found anyway. No matter how much you tinker with timers and link messages it's never quite as nice, which is a shame. (Actually I'd prefer it simply if phys vehicles were more reliable - or, even, if you could have people sitting on a phantom phys vehicle.)


Smooth movement? I'd settle for NOT exploding into a million unlinked parts if I cross a sim border at an angle or corner. Tried a couple of the nonphy scripts I have found, every one of them seems to delink prims if you hit the sim line at more than a few degrees off perpendicular. Prime reason I never finished my Caledonian Aerial Gunship....tired of finding all 240 parts of it when I forgot and hit the border wrong...or got lagged and flew into it without the chance to stop.
Thanto Usitnov
Lord Byron wannabe
Join date: 4 Aug 2006
Posts: 68
09-13-2006 16:01
I'll try the multi-script method first. I was thinking of trying something like that, but I didn't know if that was doable or not. The multiple-script method should allow me to scale speed a lot better than the way I'm doing it now.

You said there are other methods, though? That might be interesting to see. Other than multiple calls to llSetPos, what else is there to do?


As for Maklin's point, is there a way to get past this? What exactly causes the delinking? Does it only happen when only part of the vehicle goes through a sim boundary?

To get a prim unexploded, you have to get the unlinked prims back within range. To accomplish that, you could maybe have little listener scripts on each prim that have their normal local positions built-in, when a certain command is given on a certain channel, they find that position relative to the root prim, then move there. I'm not sure how they'd find the root prim, though...
Rich Cordeaux
Registered User
Join date: 8 May 2006
Posts: 26
09-13-2006 16:14
Here, have a look at this (for decently fast non-physical movement, turning, etc):
/54/65/85562/1.html

It uses the multi-script method and uses a hidden face on a prim to pass commands to the scripts.