new CVec3(X, Y, Z)
[CVec3 description]
Parameters:
Name | Type | Description |
---|---|---|
X |
Number | |
Y |
Number | |
Z |
Number |
- Source:
Methods
-
add(other)
-
Add the other into this.
Parameters:
Name Type Description other
CVec3 The other CVec3.
- Source:
-
apply2DVelocity(velocity, delta)
-
Applys a 2D Velocity to this vector with the time delta. Ignores the Y value.
Parameters:
Name Type Description velocity
CVec3 The velocity vector. This should probably be normalized.
delta
Number The amount of time to move by.
- Source:
-
apply3DVelocity(velocity, delta)
-
Applys a 3D Velocity to this vector with the time delta.
Parameters:
Name Type Description velocity
CVec3 The velocity vector. This should probably be normalized.
delta
Number The amount of time to move by.
- Source:
-
copy() → {CVec3}
-
Return a clone of the CVec3 Object.
- Source:
Returns:
A copy.
- Type
- CVec3
-
divide(other)
-
Divide this CVec3 by another CVec3.
Parameters:
Name Type Description other
CVec3 The other CVec3.
- Source:
-
get2DDirection(other) → {Number}
-
Gets the 2D direction in degrees. Ignores the Y value.
Parameters:
Name Type Description other
CVec3 The other CVec3.
- Source:
Returns:
The 2D direction between the vectors.
- Type
- Number
-
getDifference(other) → {Number}
-
Return the distance between this and another CVec3 as a number..
Parameters:
Name Type Description other
CVec3 The other CVec3.
- Source:
Returns:
The result.
- Type
- Number
-
getDistance(other) → {Number}
-
Return the absolute distance between this and another CVec3 as a number..
This will always be a positive value.Parameters:
Name Type Description other
CVec3 The other CVec3.
- Source:
Returns:
The result.
- Type
- Number
-
getVectorDifference(other) → {CVec3}
-
Return a vector of the difference between this and another CVec3.
Parameters:
Name Type Description other
CVec3 The other CVec3.
- Source:
Returns:
The result.
- Type
- CVec3
-
inspect() → {String}
-
Calls the toString method, to help with console.inspect.
- Source:
Returns:
- Type
- String
-
moveInDirection(distance, angle)
-
Takes distance and an angle in degrees and moves in that direction by the distance.
Parameters:
Name Type Description distance
Number The length to move.
angle
Number The angle to move on (in degrees).
- Source:
-
set(other)
-
Set the XYZ to another objects XYZ.
Parameters:
Name Type Description other
CVec3 | object The other object.
- Source:
-
setN(n)
-
Sets the XYZ to the same value.
Parameters:
Name Type Description n
Number The number to set them to.
- Source:
-
subtract(other)
-
Subtract the other from this.
Parameters:
Name Type Description other
CVec3 The other CVec3.
- Source:
-
toString() → {String}
-
Returns a string of the CVec3.
- Source:
Returns:
To two DP for each coordinate seperated with ', '.
- Type
- String