llRotBetween

From Second Life Wiki
Revision as of 20:14, 19 September 2007 by Ralph Doctorow (talk | contribs)
Jump to navigation Jump to search

Summary

Function: rotation llRotBetween( vector start, vector end );
0.0 Forced Delay
10.0 Energy

Returns a rotation that is the rotation between a vector pointing to start and one pointing to end

• vector start
• vector end

Specification

start and end are 2 positions which are relative to the origin of the prim the script is in. Be sure these are relative positions, not world positions, so if you have world positions, subtract the prim origin first.

Also remember that these are positions that define directions, so for example if you want to find a rotation to get from forward (along the positive X axis) to some point 45 degrees to the right, a possible set of vectors would be <1, 0, 0> and <1,-1,0>. The first defines the forward direction, the second the 45 degrees to the right (remember the right hand rule says +Y is to the left).

Examples

llRotBetween (<1, 0, 0>, <0, -1, 0>) will return <0.00000, 0.00000, -1.57080> (-1.57080 is 45 degrees in radians)

llRotBetween (<0, 0, 0>, <0, -1, 0>) will return <0.00000, 0.00000, 0.00000> because <0, 0, 0> doesn't define a direction.

See Also

Functions

•  llAngleBetween

Deep Notes

Signature

function rotation llRotBetween( vector start, vector end );