Appearance
types.vector4
A 4D vector
Properties
| Name | Description |
|---|---|
x | type: number The x component |
y | type: number The y component |
z | type: number The z component |
w | type: number The w component |
Functions
new(opt_x : number, opt_y : number, opt_z : number, opt_w : number): types.vector4
Creates a new 4D vector
- opt_x (
number) (optional) The x component - opt_y (
number) (optional) The y component - opt_z (
number) (optional) The z component - opt_w (
number) (optional) The w component - returns (
types.vector4) A new vector instance
add(other : types.vector4): types.vector4
Adds another vector to this one and returns a new vector
- other (
types.vector4) The vector to add - returns (
types.vector4) A new vector instance
sub(other : types.vector4): types.vector4
Subtracts another vector from this one and returns a new vector
- other (
types.vector4) The vector to subtract - returns (
types.vector4) A new vector instance
mul(other : types.vector4 | number): types.vector4
Multiplies this vector by another vector or a number and returns a new vector
- other (
types.vector4) | number The vector or number to multiply by - returns (
types.vector4) A new vector instance
div(other : types.vector4 | number): types.vector4
Divides this vector by another vector or a number and returns a new vector
- other (
types.vector4) | number The vector or number to divide by - returns (
types.vector4) A new vector instance
dist(other : types.vector4): number
Returns the distance between this vector and another
- other (
types.vector4) The other vector - returns (
number) The distance
length(): number
Returns the length of this vector
- returns (
number) The length
dot(other : types.vector4): number
Returns the dot product of this vector and another
- other (
types.vector4) The other vector - returns (
number) The dot product
normalize(): types.vector4
Returns a normalized (unit length) version of this vector
- returns (
types.vector4) A new normalized vector instance
