Record Class Rotation
java.lang.Object
java.lang.Record
com.zenith.feature.player.Rotation
-
Constructor Summary
ConstructorsConstructorDescriptionRotation(float yaw, float pitch) Creates an instance of aRotationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionAdds the yaw/pitch of the specified rotations to this rotation's yaw/pitch, and returns the result.clamp()static floatclampPitch(float pitch) Clamps the specified pitch value between -90 and 90.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanbooleanisReallyCloseTo(Rotation other) Is really close tostatic floatnormalizeYaw(float yaw) Normalizes the specified yaw value between -180 and 180.floatpitch()Returns the value of thepitchrecord component.Subtracts the yaw/pitch of the specified rotations from this rotation's yaw/pitch, and returns the result.final StringtoString()Returns a string representation of this record class.withPitch(float pitch) floatyaw()Returns the value of theyawrecord component.booleanyawIsClose(Rotation other, float threshold) booleanyawIsReallyClose(Rotation other)
-
Constructor Details
-
Rotation
public Rotation(float yaw, float pitch) Creates an instance of aRotationrecord class.- Parameters:
yaw- the value for theyawrecord componentpitch- the value for thepitchrecord component
-
-
Method Details
-
add
-
subtract
-
clamp
- Returns:
- A copy of this rotation with the pitch clamped
-
normalize
- Returns:
- A copy of this rotation with the yaw normalized
-
normalizeAndClamp
- Returns:
- A copy of this rotation with the pitch clamped and the yaw normalized
-
withPitch
-
isReallyCloseTo
Is really close to- Parameters:
other- another rotation- Returns:
- are they really close
-
isCloseTo
-
yawIsReallyClose
-
yawIsClose
-
clampPitch
public static float clampPitch(float pitch) Clamps the specified pitch value between -90 and 90.- Parameters:
pitch- The input pitch- Returns:
- The clamped pitch
-
normalizeYaw
public static float normalizeYaw(float yaw) Normalizes the specified yaw value between -180 and 180.- Parameters:
yaw- The input yaw- Returns:
- The normalized yaw
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
yaw
public float yaw()Returns the value of theyawrecord component.- Returns:
- the value of the
yawrecord component
-
pitch
public float pitch()Returns the value of thepitchrecord component.- Returns:
- the value of the
pitchrecord component
-