Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Confused by child rotations

Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
07-08-2008 16:43
I am doubtless being very obtuse, but can someone please explain to me what I'm supposed to do here?

The lsl wiki says,

From: someone

The usual way of rotation using llSetRot is always in relation to the world axis. To make the door rotate in relation to the whole car it is linked to, the relative rotation for the door has to be combined with the current rotation of the whole car (in relation to the world axis). Luckily, the function llSetLocalRot does exactly that.

Or, if to do it manually for some reason (such as perform a local rotation with a llSetPrimitiveParams call), this function does the same:

http://www.lslwiki.net/lslwiki/wakka.php?wakka=ChildRotation
CODE

SetLocalRot(rotation localrot) {
llSetRot(localrot / ( (ZERO_ROTATION / llGetLocalRot()) * llGetRot()));
}


I'm completely confused as to what I should put where -- llSetPrimitiveParams([PRIM_ROTATION, ???]};

Assuming I want to turn my child prims through 90 degrees, and I have already made a note of the results of llGetRot() and llGetLocalRot() for the start and end points, what do I do next?

I'm having to do it the hard way -- or I think I have to -- because the way some of the prims are cut precludes my using any of the door scripts that rely on playing with path cuts. I have played with the Timeless Door Script, which would be ideal, if only I could work out how to use a touch start to send link messages to the rest of the prims to get them to move; I don't want to use a chat command, and my attempts to introduce extra link messages into the script have met with abject failure.
Ollj Fukai
Registered User
Join date: 4 Aug 2006
Posts: 5
07-08-2008 17:37
your tutorial is old, use this:
http://wiki.secondlife.com/wiki/Rotation
for quaternion, relative, offset, linked rotation.
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
07-08-2008 19:59
From: Ollj Fukai
your tutorial is old, use this:
http://wiki.secondlife.com/wiki/Rotation
for quaternion, relative, offset, linked rotation.


Thanks, Ollj; I had, in fact, read that already, but I didn't find it particularly helpful in understanding how to set a child prim to a local rotation using llSetPrimitiveParams, which I need to do, if I possibly can, so I can get a nice smooth movement. I'm sure the information there makes sense to someone who understands rotations better than do I, but I'm still in the dark as to how to do the equivalent of llSetLocalRot() using PRIM_ROTATION.

Does the example given by Lex Neva in the jira entry on this,
From: someone

If you must set a child prim to a local rotation "rot" using PRIM_ROTATION, use this:

llSetPrimitiveParams([PRIM_ROTATION, rot/llGetRootRotation]);

https://jira.secondlife.com/browse/SVC-93?
mean I should use llGetLocalRot() to find out what the local rotation actually is for the position to which I want to move, and then manually set the variable "rot" to that value somewhere in the script?

UPDATE .. looks like that's what it did mean, since that's what I've done and it works. I had to position the object at 0,0,0 rotation using the edit tools when first I rezzed it before using llGetLocalRot(), but it seems to work fine now, no matter where I re-rez the thing