Vec3
A three dimensional vector.
Properties
x- doubley- doublez- double
Methods
Vec3:new(x, y, z)
Vec3:new(x, y, z)x- What to set x toy- What to set y toz- What to set z to
Constructs a new Vec3 with the provided x, y and z.
Example:
length()
length()Returns the length of the Vec3
Example:
distanceTo(otherVec3)
distanceTo(otherVec3)otherVec3- A different Vec3
Returns the distance from this vector to the otherVec3
Example:
distanceTo2D(otherVec3)
distanceTo2D(otherVec3)otherVec3- A different Vec3
Returns the 2D distance from this vector to the otherVec3
Example:
getXYAngle()
getXYAngle()Returns the angle which this vector is pointing at in the XY-Plane.
Example:
normalize360()
normalize360()Returns a new Vec3 where all components are normalized between 0 and 360. Useful when working with viewangles.
Example:
normalized()
normalized()Returns this vector but normalized (that is with length 1)
Example:
scale(scalar)
scale(scalar)scalar- By how much you want to scale the vector
Returns a scaled version of this vector
Example:
screenPosition()
screenPosition()Returns a Vec2 of where this Vec3 would be drawn on screen if it was a world position.
Example:
toVec2()
toVec2()Returns the first 2 components of this vector as a Vec2
Example:
toString()
toString()Returns a string representation of the Vec3
Example:
Last updated