Global to root relative transformation script

From Second Life Wiki
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();