Interface VRPoseHistory


public interface VRPoseHistory
Represents the pose history of the VR player. See VRPose for individual Pose data. In other words, it allows getting movement information of the VR player.
Vivecraft will store data for players going up to 200 ticks into the past. Attempting to retrieve history before this far back will throw an IllegalArgumentException.
Many methods in this class accept the parameter playerPositionRelative. When this is true, all calculations are done relative to the player, while if false, calculations are done in world space. For example, the net movement of a player who moved from (0, 0, 0) to (3, 0, 0) but did NOT move their head, hands, etc. would be (3, 0, 0) if playerPositionRelative is false and would be (0, 0, 0) if playerPositionRelative is true.
Since:
1.3.0
  • Method Summary

    Modifier and Type
    Method
    Description
    default net.minecraft.world.phys.Vec3
    averagePosition(VRBodyPart bodyPart, int maxTicksBack)
    Gets the average position in world space between the most recent VRPose in this instance and the oldest VRPose that can be retrieved, going no farther back than maxTicksBack.
    net.minecraft.world.phys.Vec3
    averagePosition(VRBodyPart bodyPart, int maxTicksBack, boolean playerPositionRelative)
    Gets the average position between the most recent VRPose in this instance and the oldest VRPose that can be retrieved, going no farther back than maxTicksBack.
    default double
    averageSpeed(VRBodyPart bodyPart, int maxTicksBack)
    Gets the average speed in world space in blocks/tick between the most recent VRPose in this instance and the oldest VRPose that can be retrieved, going no farther back than maxTicksBack.
    double
    averageSpeed(VRBodyPart bodyPart, int maxTicksBack, boolean playerPositionRelative)
    Gets the average speed in blocks/tick between the most recent VRPose in this instance and the oldest VRPose that can be retrieved, going no farther back than maxTicksBack.
    default net.minecraft.world.phys.Vec3
    averageVelocity(VRBodyPart bodyPart, int maxTicksBack)
    Gets the average velocity in world space in blocks/tick between the most recent VRPose in this instance and the oldest VRPose that can be retrieved, going no farther back than maxTicksBack.
    net.minecraft.world.phys.Vec3
    averageVelocity(VRBodyPart bodyPart, int maxTicksBack, boolean playerPositionRelative)
    Gets the average velocity in blocks/tick between the most recent VRPose in this instance and the oldest VRPose that can be retrieved, going no farther back than maxTicksBack.
    Gets a raw list of VRPose instances, with index 0 representing the current tick's pose, 1 representing last tick's pose, etc.
    default VRPose
    getHistoricalData(int ticksBack)
    Gets the pose from ticksBack ticks back in world space, or null if such data isn't available.
    getHistoricalData(int ticksBack, boolean playerPositionRelative)
    Gets the pose from ticksBack ticks back, or null if such data isn't available.
    default net.minecraft.world.phys.Vec3
    netMovement(VRBodyPart bodyPart, int maxTicksBack)
    Gets the net movement in world space between the most recent VRPose in this instance and the oldest VRPose that can be retrieved, going no farther back than maxTicksBack.
    net.minecraft.world.phys.Vec3
    netMovement(VRBodyPart bodyPart, int maxTicksBack, boolean playerPositionRelative)
    Gets the net movement between the most recent VRPose in this instance and the oldest VRPose that can be retrieved, going no farther back than maxTicksBack.
    int
    Gets the number of ticks, historical data is currently available for.
  • Method Details

    • ticksOfHistory

      int ticksOfHistory()
      Gets the number of ticks, historical data is currently available for. The number returned by this method will never be higher than 200, the maximum number of ticks Vivecraft holds data for, however, it can be lower than 200.
      Returns:
      The number of ticks, historical data is currently available for.
      Since:
      1.3.0
    • getAllHistoricalData

      List<VRPose> getAllHistoricalData()
      Gets a raw list of VRPose instances, with index 0 representing the current tick's pose, 1 representing last tick's pose, etc.
      Returns:
      The aforementioned list of VRPose instances.
      Since:
      1.3.0
    • getHistoricalData

      default VRPose getHistoricalData(int ticksBack) throws IllegalArgumentException
      Gets the pose from ticksBack ticks back in world space, or null if such data isn't available.
      Parameters:
      ticksBack - Ticks back to retrieve data from.
      Returns:
      A VRPose instance from ticksBack ticks ago, or null if that data isn't available.
      Throws:
      IllegalArgumentException - Thrown when ticksBack is outside the range [0,200].
      Since:
      1.3.0
    • getHistoricalData

      VRPose getHistoricalData(int ticksBack, boolean playerPositionRelative) throws IllegalArgumentException
      Gets the pose from ticksBack ticks back, or null if such data isn't available.
      Parameters:
      ticksBack - Ticks back to retrieve data from.
      playerPositionRelative - Whether to get the historical data with position relative to the player's position.
      Returns:
      A VRPose instance from ticksBack ticks ago, or null if that data isn't available.
      Throws:
      IllegalArgumentException - Thrown when ticksBack is outside the range [0,200].
      Since:
      1.3.3
    • netMovement

      @Nullable default net.minecraft.world.phys.Vec3 netMovement(VRBodyPart bodyPart, int maxTicksBack) throws IllegalArgumentException
      Gets the net movement in world space between the most recent VRPose in this instance and the oldest VRPose that can be retrieved, going no farther back than maxTicksBack.
      Parameters:
      bodyPart - The body part to get the net movement for.
      maxTicksBack - The maximum number of ticks back to compare the most recent data with.
      Returns:
      The aforementioned net movement. Note that this will return zero change on all axes if only zero ticks can be looked back. Will be null if the body part requested isn't available.
      Throws:
      IllegalArgumentException - Thrown when maxTicksBack is outside the range [0,200] or an invalid bodyPart is supplied.
      Since:
      1.3.0
    • netMovement

      @Nullable net.minecraft.world.phys.Vec3 netMovement(VRBodyPart bodyPart, int maxTicksBack, boolean playerPositionRelative) throws IllegalArgumentException
      Gets the net movement between the most recent VRPose in this instance and the oldest VRPose that can be retrieved, going no farther back than maxTicksBack.
      Parameters:
      bodyPart - The body part to get the net movement for.
      maxTicksBack - The maximum number of ticks back to compare the most recent data with.
      playerPositionRelative - Whether net movement should be calculated relative to the player position.
      Returns:
      The aforementioned net movement. Note that this will return zero change on all axes if only zero ticks can be looked back. Will be null if the body part requested isn't available.
      Throws:
      IllegalArgumentException - Thrown when maxTicksBack is outside the range [0,200] or an invalid bodyPart is supplied.
      Since:
      1.3.3
    • averageVelocity

      @Nullable default net.minecraft.world.phys.Vec3 averageVelocity(VRBodyPart bodyPart, int maxTicksBack) throws IllegalArgumentException
      Gets the average velocity in world space in blocks/tick between the most recent VRPose in this instance and the oldest VRPose that can be retrieved, going no farther back than maxTicksBack.
      Parameters:
      bodyPart - The body part to get the average velocity for.
      maxTicksBack - The maximum number of ticks back to calculate velocity with.
      Returns:
      The aforementioned average velocity on each axis. Note that this will return zero velocity on all axes if only zero ticks can be looked back. Will be null if the body part requested isn't available.
      Throws:
      IllegalArgumentException - Thrown when maxTicksBack is outside the range [0,200] or an invalid bodyPart is supplied.
      Since:
      1.3.0
    • averageVelocity

      @Nullable net.minecraft.world.phys.Vec3 averageVelocity(VRBodyPart bodyPart, int maxTicksBack, boolean playerPositionRelative) throws IllegalArgumentException
      Gets the average velocity in blocks/tick between the most recent VRPose in this instance and the oldest VRPose that can be retrieved, going no farther back than maxTicksBack.
      Parameters:
      bodyPart - The body part to get the average velocity for.
      maxTicksBack - The maximum number of ticks back to calculate velocity with.
      playerPositionRelative - Whether velocity should be calculated to the player position.
      Returns:
      The aforementioned average velocity on each axis. Note that this will return zero velocity on all axes if only zero ticks can be looked back. Will be null if the body part requested isn't available.
      Throws:
      IllegalArgumentException - Thrown when maxTicksBack is outside the range [0,200] or an invalid bodyPart is supplied.
      Since:
      1.3.3
    • averageSpeed

      default double averageSpeed(VRBodyPart bodyPart, int maxTicksBack) throws IllegalArgumentException
      Gets the average speed in world space in blocks/tick between the most recent VRPose in this instance and the oldest VRPose that can be retrieved, going no farther back than maxTicksBack.
      Parameters:
      bodyPart - The body part to get the average speed for.
      maxTicksBack - The maximum number of ticks back to calculate speed with.
      Returns:
      The aforementioned average speed on each axis. Note that this will return zero speed if only zero ticks can be looked back, or if the body part requested isn't available.
      Throws:
      IllegalArgumentException - Thrown when maxTicksBack is outside the range [0,200] or an invalid bodyPart is supplied.
      Since:
      1.3.0
    • averageSpeed

      double averageSpeed(VRBodyPart bodyPart, int maxTicksBack, boolean playerPositionRelative) throws IllegalArgumentException
      Gets the average speed in blocks/tick between the most recent VRPose in this instance and the oldest VRPose that can be retrieved, going no farther back than maxTicksBack.
      Parameters:
      bodyPart - The body part to get the average speed for.
      maxTicksBack - The maximum number of ticks back to calculate speed with.
      playerPositionRelative - Whether the speed should be calculated relative to the player position.
      Returns:
      The aforementioned average speed on each axis. Note that this will return zero speed if only zero ticks can be looked back, or if the body part requested isn't available.
      Throws:
      IllegalArgumentException - Thrown when maxTicksBack is outside the range [0,200] or an invalid bodyPart is supplied.
      Since:
      1.3.3
    • averagePosition

      @Nullable default net.minecraft.world.phys.Vec3 averagePosition(VRBodyPart bodyPart, int maxTicksBack) throws IllegalArgumentException
      Gets the average position in world space between the most recent VRPose in this instance and the oldest VRPose that can be retrieved, going no farther back than maxTicksBack.
      Parameters:
      bodyPart - The body part to get the average position for.
      maxTicksBack - The maximum number of ticks back to calculate the position with.
      Returns:
      The aforementioned average position. Note that this will return the current position if only zero ticks can be looked back. Will be null if the body part requested isn't available.
      Throws:
      IllegalArgumentException - Thrown when maxTicksBack is outside the range [0,200] or an invalid bodyPart is supplied.
      Since:
      1.3.0
    • averagePosition

      @Nullable net.minecraft.world.phys.Vec3 averagePosition(VRBodyPart bodyPart, int maxTicksBack, boolean playerPositionRelative) throws IllegalArgumentException
      Gets the average position between the most recent VRPose in this instance and the oldest VRPose that can be retrieved, going no farther back than maxTicksBack.
      Parameters:
      bodyPart - The body part to get the average position for.
      maxTicksBack - The maximum number of ticks back to calculate the position with.
      playerPositionRelative - Whether the positions should be relative to the player's position.
      Returns:
      The aforementioned average position. Note that this will return the current position if only zero ticks can be looked back. Will be null if the body part requested isn't available.
      Throws:
      IllegalArgumentException - Thrown when maxTicksBack is outside the range [0,200] or an invalid bodyPart is supplied.
      Since:
      1.3.3