Enum Class PlayerBodyPart

java.lang.Object
java.lang.Enum<PlayerBodyPart>
net.timtaran.interactivemc.body.player.PlayerBodyPart
All Implemented Interfaces:
Serializable, Comparable<PlayerBodyPart>, Constable

public enum PlayerBodyPart extends Enum<PlayerBodyPart>
Enumeration of player body parts that can be controlled and interacted with in VR.

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:
  • Enum Constant Details

  • Method Details

    • values

      public static PlayerBodyPart[] 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

      public static PlayerBodyPart valueOf(String name)
      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 name
      NullPointerException - 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 an InteractionHand to its corresponding PlayerBodyPart.

      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 this PlayerBodyPart to its corresponding VRBodyPart.

      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