Skip to content

Vec3

Vec3 represents a 3d vector with x, y, and z coordinates for position calculations.

propertytypedescription
xdoublex coordinate
ydoubley coordinate
zdoublez coordinate

ceil

Returns a new vector with coordinates rounded up.

java
Vec3 ceiled = position.ceil();

equals

Compares two vectors for equality.

java
boolean equal = position.equals(Vec3 other);

floor

Returns a new vector with coordinates rounded down.

java
Vec3 floored = position.floor();

inverse

Returns a new vector with negated coordinates.

java
Vec3 inverse = position.inverse();

offset

Returns a new vector offset by another vector.

java
Vec3 offset = position.offset(Vec3 amount);

offset

Returns a new vector offset by values.

java
Vec3 offset = position.offset(double x, double y, double z);

translate

Returns current vector translated by another vector.

java
Vec3 translated = position.translate(Vec3 amount);

translate

Returns current vector translated by values.

java
Vec3 translated = position.translate(double x, double y, double z);

distanceTo

Returns the distance to another vector.

java
double distance = position.distanceTo(Vec3 other);

distanceToSq

Returns the squared distance to another vector.

java
double distanceSq = position.distanceToSq(Vec3 other);