Enum Class PlayerBodyPart
- All Implemented Interfaces:
Serializable,Comparable<PlayerBodyPart>,Constable
This enum defines all the different body parts that make up a player's physical representation in the physics world. Each body part has associated physics shapes, pivot points for joints, grab points for interaction, and tracking offsets for VR controller positioning.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic PlayerBodyPartfromInteractionHand(net.minecraft.world.InteractionHand interactionHand) Converts anInteractionHandto its correspondingPlayerBodyPart.com.github.stephengold.joltjni.RVec3Gets the local grab point on this body part in RVec3 format.org.joml.Vector3fGets the local grab point on this body part in Vector3f format.net.minecraft.world.phys.Vec3Calculates the local pivot point on this body part for its joint connection.com.github.stephengold.joltjni.Vec3getSize()Gets the full size of this body part.net.minecraft.world.phys.Vec3Gets the tracking offset applied to VR controller data for this body part.org.vivecraft.api.data.VRBodyPartConverts thisPlayerBodyPartto its correspondingVRBodyPart.static PlayerBodyPartReturns the enum constant of this class with the specified name.static PlayerBodyPart[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
HEAD
-
MAIN_HAND
-
OFF_HAND
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getSize
public com.github.stephengold.joltjni.Vec3 getSize()Gets the full size of this body part.The size represents the dimensions of the physics shape (width x height x depth). This is the full size, not half-extents.
- Returns:
- a vector representing the width, height, and depth
-
getLocalPivot
public net.minecraft.world.phys.Vec3 getLocalPivot()Calculates the local pivot point on this body part for its joint connection. This is typically at the top-center for limbs and the bottom-center for the head.- Returns:
- A vector representing the local pivot point.
-
getLocalGrabPoint
public com.github.stephengold.joltjni.RVec3 getLocalGrabPoint()Gets the local grab point on this body part in RVec3 format.This point defines where objects are grabbed when a player tries to grab something with this body part. For hands, it's at the tip.
- Returns:
- a vector in local space representing the grab point (RVec3 format)
-
getLocalGrabPointVec3f
public org.joml.Vector3f getLocalGrabPointVec3f()Gets the local grab point on this body part in Vector3f format.This is the same as
getLocalGrabPoint()but in JOML Vector3f format for convenience when working with JOML math operations.- Returns:
- a vector in local space representing the grab point (Vector3f format)
-
getTrackingOffset
public net.minecraft.world.phys.Vec3 getTrackingOffset()Gets the tracking offset applied to VR controller data for this body part.This offset is applied when tracking the body part's position from VR controller data. It compensates for the difference between where the VR controller is held and where the actual body part should be physically located.
- Returns:
- a vector representing the offset to apply to tracked position
-
fromInteractionHand
public static PlayerBodyPart fromInteractionHand(net.minecraft.world.InteractionHand interactionHand) Converts anInteractionHandto its correspondingPlayerBodyPart.This is a convenience method to map the standard Minecraft hand types to the appropriate player body parts. The head body part has no corresponding hand.
- Parameters:
interactionHand- the interaction hand (main or off-hand)- Returns:
- the corresponding player body part
- Throws:
NullPointerException- if interactionHand is null
-
toVRBodyPart
public org.vivecraft.api.data.VRBodyPart toVRBodyPart()Converts thisPlayerBodyPartto its correspondingVRBodyPart.This is used for integration with the ViveCraft API to get VR-specific data for this body part, such as VR pose information.
- Returns:
- the corresponding VR body part from the ViveCraft API
-