Constructor
new Vector3(xopt, yopt, zopt, onChangeopt)
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
x |
number |
<optional> |
0 | X component. |
y |
number |
<optional> |
0 | Y component. |
z |
number |
<optional> |
0 | Z component. |
onChange |
function | null |
<optional> |
null | Called, when any component changes. |
- Source:
Classes
Members
x
- Source:
x
- Source:
y
- Source:
y
- Source:
z
- Source:
z
- Source:
Methods
copyFrom(other) → {Vector3}
Copies components from another `Vector3`.
Parameters:
| Name | Type | Description |
|---|---|---|
other |
Vector3 | Source vector to copy components from. |
- Source:
Returns:
- This vector instance after copying components from the source vector (for chaining).
- Type
- Vector3
set(x, y, z) → {Vector3}
Sets all components at once.
Calls onChange at most once.
Parameters:
| Name | Type | Description |
|---|---|---|
x |
number | New X component value. |
y |
number | New Y component value. |
z |
number | New Z component value. |
- Source:
Returns:
- This vector instance (for chaining).
- Type
- Vector3
setOnChange(onChange) → {Vector3}
Sets or clears the 'onChange' callback.
Parameters:
| Name | Type | Description |
|---|---|---|
onChange |
function | null | Callback invoked, when any component changes or null to disable the change notifications. |
- Source:
Returns:
- This vector instance (for chaining).
- Type
- Vector3
(static) createUnitScale(onChangeopt) → {Vector3}
Creates a new (1, 1, 1) vector.
This value is commonly used as a unit scale vector.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
onChange |
function | null |
<optional> |
null | Optional callback invoked, when the vector changes. |
- Source:
Returns:
- New vector with all components set to one.
- Type
- Vector3
(static) createZero(onChangeopt) → {Vector3}
Creates a new (0, 0, 0) vector.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
onChange |
function | null |
<optional> |
null | Optional callback invoked, when the vector changes. |
- Source:
Returns:
- New vector with all components set to zero.
- Type
- Vector3