Difference between revisions of "Global to root relative transformation script"
Jump to navigation
Jump to search
Fritz Kakapo (talk | contribs) m (links) |
|||
Line 1: | Line 1: | ||
A script in a child [[primitive] of an [[object]] may need to transform a location or other [[vector]] from global [[Viewer coordinate frames|coordinates]] to root relative coordinates. | A script in a child [[primitive]] of an [[object]] may need to transform a location or other [[vector]] from global [[Viewer coordinate frames|coordinates]] to root relative coordinates. | ||
The angular transformation for a vector can be done by: | The angular transformation for a vector can be done by: | ||
<pre> | |||
relative_pos = ( global_pos - llGetRootPosition() ) / llGetRootRotation(); | |||
</pre> | |||
Rotations can be similarly transformed. | |||
<pre> | |||
relative_rot = global_rot / llGetRootRotation(); | |||
</pre> | |||
Latest revision as of 22:48, 6 June 2007
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();