/
setLength
setLength
Description
Returns a scaled vector of length len, collinear with vec. Does not modify vec.
Use setLength when you need to set the length of a given vector. For example, you might want to change the length of a given bone, which can be thought of as vector from one bone joint to another.
The length of the vector is the square root of the sum of the squares of each vector component.
Useful for setting the lengths of the bones in a skeleton based on performer dimensions.
Note that the input vector vector is not modified.
Functional area
Math
Command syntax
Syntax
setLength vector length |
Arguments
Name | Type | Required | Comments |
---|---|---|---|
vector | vector | yes | Vector that points in the desired direction |
length | float | yes | Float value of vector length or magnitude |
Flags
None
Return value
vector
Returns a variable of type vector which points in the same direction as vec, but is of length len.
Examples
// Declare a vector, then changes its length // The command will return a vector value of: <> vector $v1 = <<1, 1, 0>>, $v1 = `setLength $v1 1.0`; print( $v1 );
Additional information
Related commands
, multiple selections available,