function
Function syntax
vector llVecNorm(vector vec// Vector to normalize.
);- Returns
vector- Energy
- 10
Returns the normalized unit vector pointing the same direction as vec. If <0, 0, 0>, return <0, 0, 0>.
If vec is a ZERO_VECTOR, than the value returned is a ZERO_VECTOR.
vector result = llVecNorm(ZERO_VECTOR);Examples
Section titled “Examples”Example 1
default { state_entry() { vector input = <1.0,2.0,3.0>; llSay(0,"The unit vector on "+(string)input+" is: "+(string)llVecNorm(input) ); }}- Mathematically equivalent to:
- vec /
llVecMag( vec ) - vec /
llSqrt( vec.x * vec.x + vec.y * vec.y + vec.z * vec.z )
Known issues
Section titled “Known issues”From the issue templates included by the wiki article:
- SVC-4711 (bug): llVecNorm returns zero vector as result when input is below a certain magnitude
See also
Section titled “See also”Functions
Section titled “Functions”Original wiki source
Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.