Talk:Viewer coordinate frames

From Second Life Wiki
Revision as of 14:30, 11 December 2007 by Wood Wheels (talk | contribs) (New page: How to calculate the local coordinate of a linked prim from a script in the root is not documented in the wiki. The problem being that the linked prim position is given in region coordinat...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

How to calculate the local coordinate of a linked prim from a script in the root is not documented in the wiki. The problem being that the linked prim position is given in region coordinates and setting the location of a linked prim needs to be in local coordinates.

It is anti-intuitive (you subtract the root position from the prim position), but like this: <lsl> key keyObj = llGetLinkKey(i); list a = llGetObjectDetails(keyObj,([OBJECT_POS])); // returns region coordinate vector localp = llList2Vector(a,0) - llGetRootPosition();

// and later you can use this to set another prim to that location using: llSetLinkPrimitiveParams(i,[PRIM_POSITION,localp]); //expects local coordinate </lsl>