-
Notifications
You must be signed in to change notification settings - Fork 2
IVRAPI
The IVRAPI interface contains the upper-level of the API. It contains several functions:
getVersionString(): Returns the version String for the API. As of writing, this returns "1.1.0".
apiActive(PlayerEntity player): Whether or not the VRAPI is active and running on both the logical side and client side.
getVersionArray(): Returns the version as an array. As of writing, this returns {1, 1, 0}
getVRPlayer(PlayerEntity player): Gets an instance of IVRPlayer for the specified player based on their tick data, or null if the player is not in VR (or if this is being run server-side, null may also be received if the server hasn't received VR info yet).
getPreTickVRPlayer(): Gets an instance of IVRPlayer based on the local player's tick data before the game tick. Only available client side!
getRenderVRPlayer(): Gets an instance of IVRPlayer based on the local player's data just before the frame is rendered. Useful for custom rendering, and available only on the client!
getPreTickRoomVRPlayer(): Gets an instance of IVRPlayer based on the local player's data relative to the room they're physically in rather than the world. This data is from before the game tick, and available client-side only!
getPostTickRoomVRPlayer(): Gets an instance of IVRPlayer based on the local player's data relative to the room they're physically in rather than the world. This data is from after the game tick, and available client-side only!
playerInVR(PlayerEntity player): Returns true if the player is in VR, or false if they are not. Runs more quickly than getVRPlayer(player) != null.
triggerHapticPulse(int controllerNum, float durationSeconds, @Nullable ServerPlayerEntity player): Triggers a haptic pulse on the specified controller numbered controllerNum for durationSeconds seconds. If the player argument is specified and the code is server-side, a packet will be sent to the client to trigger the specified haptic pulse.
triggerHapticPulse(int controllerNum, float durationSeconds, float frequency, float amplitude, float delaySeconds, @Nullable ServerPlayerEntity player): A more advanced version of the above triggerHapticPulse function, that allows specifying the frequency and amplitude of the rumble/haptic pulse. The haptics begin after delaySeconds sesconds.
isSeated(Player player): Whether the given player is currently playing using seated mode.
isLeftHanded(Player player): Whether the given player is using "Reverse Hands" in Vivecraft.
Logical Sides and Ping Limitations
VRPlayerTickEvent (Removed as of 2.0.0 Pre-Release 1)