Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Get LocalRot of the attached root prim within a child

Ratus Waydelich
Registered User
Join date: 7 Mar 2007
Posts: 14
09-14-2007 00:42
Hi.

I am curious how to gain the LocalRot of the attached root prim from within a child of that object.

The idea is to get a rotation work within an attached object e.g. holding a gadget and open its lid.

There is already a good idea that mention how to do the rotatin in this article:
/54/85/170765/1.html#post1676086

The mentioned method to get the LocalRot of the root is to send it via linked message.

I don't like that and would prefer a more independent method.


The new Idea:

You know the local rotation of the child (LRC) via llGetLocalRot within the child.
You know the global rotation of the child (GRC) via llGetRot within the cild.
You know the global rotation of the avatar (GRA) via llGetRootRot within the child.

So to get the local rotation of the root prim (LRR) you just have to compute something like:

LRR = GRC + LRC - GRA

Is this correct? And if, how has this to be done in LSL using quaternations?
(And if, why isn't a wonderfull example available in the wiki?)
Tiarnalalon Sismondi
Registered User
Join date: 1 Jun 2006
Posts: 402
09-14-2007 05:47
Ok...I have to ask...local rot when compared to what? Child prims and their local rot is calculated on their relation to the root prim. That's essentially what the local rot is for.

The only time a root prim can have a local rot or local pos is when it's being worn by an avatar because even though it is technically still the root prim, all location information is calculated based on it's relationship to the attachment point instead of the global position. In these cases the roots local rot is found just like any child's.

If you're talking about a local rot when compared to the rot of the child prim with the script, I would think you could do some math when comparing the Global rotations for both prims directly.