Contents
- Description
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- set(Transform)
- getPosition()
- setPosition(Vector3dc)
- getRotation()
- setRotation(Rotation3fc)
- getDirection()
- getDirection(float, float)
- getAxisDirection()
- getAxisDirection(float, float)
- getAxis()
- clone()
- equals(Object)
- hashCode()
- toString()
- applyMaskedRelativeTransform(Transform, byte, Vector3dc, Rotation3fc, Vector3ic)
Class Transform
java.lang.Object
com.hypixel.hytale.math.vector.Transform
A class that represents a position and rotation in 3D space.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BuilderCodec<Transform> The codec used to parseTransforminstances.static final BuilderCodec<Transform> The codec used to parseTransforminstances but with the angles as degreesstatic final BuilderCodec<Transform> The codec used to parseTransforminstances with default rotation values ofFloat.NaN.static final intA bitmask constant indicating that the Pitch component is relative.static final intA bitmask constant indicating that the transform is relative to a block position.static final intA bitmask constant indicating that the Roll component is relative.static final intA bitmask constant indicating that the X component is relative.static final intA bitmask constant indicating that the Y component is relative.static final intA bitmask constant indicating that the Yaw component is relative.static final intA bitmask constant indicating that the Z component is relative. -
Constructor Summary
ConstructorsConstructorDescriptionEmpty Constructor for aTransforminstance.Transform(double x, double y, double z) Default Constructor for aTransforminstance.Transform(double x, double y, double z, float pitch, float yaw, float roll) Default Constructor for aTransforminstance.Create a newTransformwhose values will be copied from the given transform.Transform(org.joml.Vector3dc position) Default Constructor for aTransforminstance.Transform(org.joml.Vector3dc position, Rotation3fc rotation) Constructor for aTransforminstance that copies the given position and rotation.Transform(org.joml.Vector3d position, Rotation3f rotation) Default Constructor for aTransforminstance.Transform(org.joml.Vector3ic position) Default Constructor for aTransforminstance. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyMaskedRelativeTransform(Transform transform, byte relativeMask, org.joml.Vector3dc sourcePosition, Rotation3fc sourceRotation, org.joml.Vector3ic blockPosition) Modifies the transform provided using the provided relative mask and source positions.clone()booleangetAxis()org.joml.Vector3iorg.joml.Vector3igetAxisDirection(float pitch, float yaw) Called to get the axis direction vector from the given pitch and yaw.org.joml.Vector3dstatic org.joml.Vector3dgetDirection(float pitch, float yaw) Called to get the direction vector from the given pitch and yaw.org.joml.Vector3dinthashCode()voidCalled to assign the values from another transform to this one.voidsetPosition(org.joml.Vector3dc position) Called to set the position of the transform.voidsetRotation(Rotation3fc rotation) Called to set the rotation of the transform.toString()
-
Field Details
-
CODEC
The codec used to parseTransforminstances. -
PARTIAL_TELEPORT_CODEC
-
CODEC_DEGREES
The codec used to parseTransforminstances but with the angles as degrees -
X_IS_RELATIVE
public static final int X_IS_RELATIVEA bitmask constant indicating that the X component is relative.- See Also:
-
Y_IS_RELATIVE
public static final int Y_IS_RELATIVEA bitmask constant indicating that the Y component is relative.- See Also:
-
Z_IS_RELATIVE
public static final int Z_IS_RELATIVEA bitmask constant indicating that the Z component is relative.- See Also:
-
YAW_IS_RELATIVE
public static final int YAW_IS_RELATIVEA bitmask constant indicating that the Yaw component is relative.- See Also:
-
PITCH_IS_RELATIVE
public static final int PITCH_IS_RELATIVEA bitmask constant indicating that the Pitch component is relative.- See Also:
-
ROLL_IS_RELATIVE
public static final int ROLL_IS_RELATIVEA bitmask constant indicating that the Roll component is relative.- See Also:
-
RELATIVE_TO_BLOCK
public static final int RELATIVE_TO_BLOCKA bitmask constant indicating that the transform is relative to a block position.- See Also:
-
-
Constructor Details
-
Transform
-
Transform
public Transform(@Nonnull org.joml.Vector3ic position) Default Constructor for aTransforminstance.- Parameters:
position- The position of the transform.
-
Transform
public Transform(@Nonnull org.joml.Vector3dc position) Default Constructor for aTransforminstance.- Parameters:
position- The position of the transform.
-
Transform
public Transform(double x, double y, double z) Default Constructor for aTransforminstance.- Parameters:
x- The x position of the transform.y- The y position of the transform.z- The z position of the transform.
-
Transform
public Transform(double x, double y, double z, float pitch, float yaw, float roll) Default Constructor for aTransforminstance.- Parameters:
x- The x position of the transform.y- The y position of the transform.z- The z position of the transform.pitch- The pitch rotation of the transform.yaw- The yaw rotation of the transform.roll- The roll rotation of the transform.
-
Transform
-
Transform
Constructor for aTransforminstance that copies the given position and rotation.- Parameters:
position- The position to copy into the transform.rotation- The rotation to copy into the transform.
-
Transform
Default Constructor for aTransforminstance.- Parameters:
position- The position of the transform.rotation- The rotation of the transform.
-
-
Method Details
-
set
Called to assign the values from another transform to this one.- Parameters:
transform- The transform to copy from.
-
getPosition
@Nonnull public org.joml.Vector3d getPosition()- Returns:
- the position of the transform.
-
setPosition
public void setPosition(@Nonnull org.joml.Vector3dc position) Called to set the position of the transform.- Parameters:
position- The given position to set.
-
getRotation
- Returns:
- the rotation of the transform.
-
setRotation
Called to set the rotation of the transform.- Parameters:
rotation- The given rotation to set.
-
getDirection
@Nonnull public org.joml.Vector3d getDirection()- Returns:
- The direction of the rotation
-
getDirection
@Nonnull public static org.joml.Vector3d getDirection(float pitch, float yaw) Called to get the direction vector from the given pitch and yaw.- Parameters:
pitch- The pitch of the rotation.yaw- The yaw of the rotation.- Returns:
- The direction of the rotation.
-
getAxisDirection
@Nonnull public org.joml.Vector3i getAxisDirection()- Returns:
- The direction of the rotation locked to an axis
-
getAxisDirection
@Nonnull public org.joml.Vector3i getAxisDirection(float pitch, float yaw) Called to get the axis direction vector from the given pitch and yaw.- Parameters:
pitch- The pitch of the rotation.yaw- The yaw of the rotation.- Returns:
- The direction of the rotation locked to an axis
-
getAxis
- Returns:
- The axis of the rotation
-
clone
-
equals
-
hashCode
-
toString
-
applyMaskedRelativeTransform
public static void applyMaskedRelativeTransform(@Nonnull Transform transform, byte relativeMask, @Nonnull org.joml.Vector3dc sourcePosition, @Nonnull Rotation3fc sourceRotation, @Nonnull org.joml.Vector3ic blockPosition) Modifies the transform provided using the provided relative mask and source positions.The mask bits are as follows: 0b0000001 = X is relative 0b0000010 = Y is relative 0b0000100 = Z is relative 0b0001000 = Yaw is relative 0b0010000 = Pitch is relative 0b0100000 = Roll is relative 0b1000000 = Is relative to block
- Parameters:
transform- The transform to modifyrelativeMask- The mask to use for selectively apply relative transformations.sourcePosition- The position to use as the source for a relative transformation.sourceRotation- The rotation to use as the source for a relative transformation.blockPosition- The block position to use as the source for a relative block transformation.
-