Global to root relative transformation script

From Second Life Wiki
Revision as of 22:48, 6 June 2007 by Strife Onizuka (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

A script in a child primitive of an object may need to transform a location or other vector from global coordinates to root relative coordinates. The angular transformation for a vector can be done by:

relative_pos = ( global_pos - llGetRootPosition() ) / llGetRootRotation();

Rotations can be similarly transformed.

relative_rot = global_rot / llGetRootRotation();