Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Moving two prims identically?

Cyrus Odets
Registered User
Join date: 5 Oct 2005
Posts: 51
07-26-2006 20:13
I'm hoping someone can help me out here, and I'm hoping there is an 'easier' and better-looking way to do this...

If you have one big linked object....and 2 of the child prims of that object you want to MOVE....the exact same distance at the exact same speed....what is the best way to do that?

I'll elaborate a bit more....

For example...lets say you have a big machine that has a mechanical arm and fist (Mechanical 'arm' is one child prim, the 'fist' is another) that, when you press a button, jerks back and forth in a 'punching' motion.

So...lets say you have a timer() set to make the fist 'punch' every second. Each second the script sends a link_message to both the 'fist' and the 'arm' to use llSetPos() to move forward 1 meter from the root prim.

However, this method causes the fist and the arm to USUALLY move together and look correct...but about half the time...the 'fist' prim separates slightly from the 'arm' prim leaving a 'gap' between them....or....the 'arm' prim moves faster than the 'fist' prim and overlaps the 'fist' prim too much.

Is there some way to make the fist 'stuck' to the 'arm' so that they ALWAYS move together, when they are still both child prims of a larger linked object? Does someone know a better way to do this WITHOUT unlinking the arm/fist and linking them into a separate object?

Thanks!
namwob Keynes
Registered User
Join date: 13 Apr 2006
Posts: 6
07-27-2006 06:58
if the machine is static (like you wont be moving it) then you should be able to define definite positions and rotations. maybe use something like llGetWallTime() which is in sync with all the prims on the grid
Rodrick Harrington
Registered User
Join date: 9 Jul 2005
Posts: 150
07-27-2006 09:19
worth a try there but not sure if that'd do what you want still as it'd require synched timers. The short answer from me is I have no idea how you'd do it better than linked messages, on a non-laggy sim at all and with nothing else in the movement script (so it doesn't have to finish events before moving) it should be as close as you can get in LSL iirc.
_____________________
Dominic Webb
Differential Engineer
Join date: 1 Feb 2006
Posts: 73
07-27-2006 09:27
From: Cyrus Odets
I'm hoping someone can help me out here, and I'm hoping there is an 'easier' and better-looking way to do this...

If you have one big linked object....and 2 of the child prims of that object you want to MOVE....the exact same distance at the exact same speed....what is the best way to do that?


Have a very small script in the prims-to-move that does the actual moving, and a master script which tells them how and where to move..

An example of this can be seen at my workshop - look for the sandbox-looking thing inside with a single-jointed arm on it.

The control pad should be self-explanatory.



- d.
_____________________
.sig space for rent.
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
07-27-2006 17:35
The separation/overlap - is that during the motion, or do they end up offset from each other? If it's during the movement, that's hard to improve without the unlinking/separate object solution. Getting that exactly right requires that the scripts in the child prims fire at exactly the same time, which you have no control over. You could maybe help it by reducing the amount of processing the receiving script has to do. For instance, are you sending the vector over in the link message? Try hard coding that into the child prim script. If your command is a string that the child script checks for, try using integers instead. Stuff like that. That might reduce the chances of the two scripts taking different amounts of time to process the link message.

If they end up at offset positions, then it looks like something else might be wrong. Maybe after the SetPos call, check again with GetPos, and maybe you'll detect that you're not exactly where you wanted to be, so SetPos again? I dunno... hard to suggest a solution, because I'm not sure why they would end up offset.