Vector3.setScalar()
Set the x, y and/or z values from the scalars given as parameters
Parameters
Name | Type | Description | |
---|---|---|---|
1 | x | number | null | Value of the X axis |
2 | y | number | null | undefined | Value of the Y axis |
3 | z | number | null | undefined | Value of the Z axis |
Return value
Vector3
Usage
import {Vector3} from '@lcluber/type6js';
// set from scalars
let vector = new Vector3(1,1,1);
console.log(vector); //(1,1,1)
vector.setScalar(2,2,2);
console.log(vector); //(2,2,2)
// set x axis only
let vector = new Vector3(3);
console.log(vector); //(3,0,0)
vector.setScalar(2);
console.log(vector); //(2,0,0)
// set y axis only
let vector = new Vector3(null, 3, null);
console.log(vector); //(0,3,0)
vector.setScalar(null,2, null);
console.log(vector); //(0,2,0)
// set z axis only
let vector = new Vector3(null, null, 3);
console.log(vector); //(0,0,3)
vector.setScalar(null, null, 2);
console.log(vector); //(0,0,2)