Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Moving linked prims... $L500 for an answer.

Mike Zidane
Registered User
Join date: 10 Apr 2004
Posts: 255
09-22-2004 08:32
Example:

Here we see two must-be-linked primitives. The horizontal prim is the parent.


. . |
. . |
----------
. . |
. . |

I can move the vertical prim up and down in relation to the parent with llSetPos() easily enough.

Now here's what I'm trying to do:


. . . . ./
. . . . /
----------
. . . /
. . ./


Here, the vertical prim is on an angle, and when I move it up and down, I want it to move along it's own Z axis. That is, up and down diagonally.

Can someone help me out?

L$500 for a solution.
Wednesday Grimm
Ex Libris
Join date: 9 Jan 2003
Posts: 934
09-22-2004 08:49
Wouldn't that just be:

vector zMove = <0.0, 0.0, 1.0>;
llSetPos(llGetLocalPos() + (zMove * llGetLocalRot()));

then set zMove = -1 * zMove to move back down?
_____________________
Sarcasm meter:
0 |-----------------------*-| 10
Rating: Awww Jeeze!
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
09-22-2004 08:51
llSetPos(destpos*llGetRot()); ?
Jack Digeridoo
machinimaniac
Join date: 29 Jul 2003
Posts: 1,170
09-22-2004 08:51
Create a 3rd prim, make it invisible and use it as the root so local set pos's will work the way you expect?
_____________________
If you'll excuse me, it's, it's time to make the world safe for democracy.
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
09-22-2004 08:54
From: someone
Originally posted by Wednesday Grimm
Wouldn't that just be:

vector zMove = <0.0, 0.0, 1.0>;
llSetPos(llGetLocalPos() + (zMove * llGetLocalRot()));

then set zMove = -1 * zMove to move back down?

Doesnt he have to factor in the parent objects rotation as well? The new llGetRootRot is really handy for that. It used to be that we had to get it with link messages.
Wednesday Grimm
Ex Libris
Join date: 9 Jan 2003
Posts: 934
09-22-2004 09:02
From: someone
Originally posted by Eggy Lippmann
Doesnt he have to factor in the parent objects rotation as well? The new llGetRootRot is really handy for that. It used to be that we had to get it with link messages.


No, sub object position is relative to the root object, not the world co-ordinate system.
_____________________
Sarcasm meter:
0 |-----------------------*-| 10
Rating: Awww Jeeze!
Tiger Crossing
The Prim Maker
Join date: 18 Aug 2003
Posts: 1,560
09-22-2004 09:10
So make this...
CODE
       |
| /
| /
/
/ |
/ |
|

And make the / prim move up and down straight. Then tip the whole thing on its side a bit so the | line is / and the / line is --. Since the motion is relative to the root prim, you can rotate the whole thing so it looks right after building it to move in ordinal directions.
_____________________
~ Tiger Crossing
~ (Nonsanity)
Mike Zidane
Registered User
Join date: 10 Apr 2004
Posts: 255
09-22-2004 10:58
Thank you Mr. Grimm! Works like a charm.

You've got mail!