Interface VRPoseHistory
- All Known Implementing Classes:
VRPoseHistoryImpl
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.
History is stored up to MAX_TICKS_BACK 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.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescription@Nullable net.minecraft.world.phys.Vec3averageVelocity(PlayerBodyPart 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 thanmaxTicksBack.Gets a raw list ofVRPoseinstances, with index 0 representing the current tick's pose, 1 representing last tick's pose, etc.getHistoricalData(int ticksBack, boolean playerPositionRelative) Gets the pose fromticksBackticks back, ornullif such data isn't available.@Nullable net.minecraft.world.phys.Vec3netMovement(PlayerBodyPart 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 thanmaxTicksBack.intGets the number of ticks, historical data is currently available for.
-
Field Details
-
MAX_TICKS_BACK
static final int MAX_TICKS_BACK- See Also:
-
-
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 thanMAX_TICKS_BACK, the maximum number of ticks this implementation holds data for, however, it can be lower thanMAX_TICKS_BACK.- Returns:
- The number of ticks, historical data is currently available for.
-
getAllHistoricalData
Gets a raw list ofVRPoseinstances, with index 0 representing the current tick's pose, 1 representing last tick's pose, etc.- Returns:
- The aforementioned list of
VRPoseinstances.
-
getHistoricalData
VRPose getHistoricalData(int ticksBack, boolean playerPositionRelative) throws IllegalArgumentException Gets the pose fromticksBackticks back, ornullif 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
VRPoseinstance fromticksBackticks ago, ornullif that data isn't available. - Throws:
IllegalArgumentException- Thrown whenticksBackis outside the range [0,200].
-
netMovement
@Nullable @Nullable net.minecraft.world.phys.Vec3 netMovement(PlayerBodyPart 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 thanmaxTicksBack.- 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
nullif the body part requested isn't available. - Throws:
IllegalArgumentException- Thrown whenmaxTicksBackis outside the range [0,200] or an invalidbodyPartis supplied.
-
averageVelocity
@Nullable @Nullable net.minecraft.world.phys.Vec3 averageVelocity(PlayerBodyPart 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 thanmaxTicksBack.- 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
nullif the body part requested isn't available. - Throws:
IllegalArgumentException- Thrown whenmaxTicksBackis outside the range [0,200] or an invalidbodyPartis supplied.
-