Skip to main content
Version: Current

XR Actions

  • ARSupportedAction

    Defines an event that checks for AR support on the device.

    Members

    • playerId? string

      The ID of the player that created this task. Set by remote action handlers when a task is recieved from a remote player.

    • taskId (string | number)

      The ID of the async task.

    • type "ar_supported"

      The type of the event. This helps determine how the event should be applied to the state.

    • uncopiable? boolean

      Whether the action can be structure cloned. If true, then the action should not be passed across message ports without special handling.

  • EnableARAction

    Defines an event that enables AR on the device.

    Members

    • enabled boolean

      Whether AR features should be enabled.

    • options EnableXROptions

      The additional options that should be used.

    • type "enable_ar"

  • EnableVRAction

    Defines an event that enables VR on the device.

    Members

    • enabled boolean

      Whether VR features should be enabled.

    • options EnableXROptions

      The additional options that should be used.

    • type "enable_vr"

  • EnableXROptions

    Defines an interface that represents the options that an EnableARAction or EnableVRAction can have.

    Members

    • frameBufferScaleFactor? (number | "recommended")

      The frame buffer scale factor that should be used for the XR session. (see https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLLayer/getNativeFramebufferScaleFactor)

      • Null or undefined indicates that the default should be used. (usually 1)
      • A number indicates the ratio of frame buffer pixels to output pixels. (e.g. a value of 2 will cause every 2 frame buffer pixels to be correlated with 1 output pixel, meaning that the render resolution is doubled)
      • "recommended" indicates that CasualOS should try to pick the optimal number.
  • VRSupportedAction

    Defines an event that checks for VR support on the device.

    Members

    • playerId? string

      The ID of the player that created this task. Set by remote action handlers when a task is recieved from a remote player.

    • taskId (string | number)

      The ID of the async task.

    • type "vr_supported"

      The type of the event. This helps determine how the event should be applied to the state.

    • uncopiable? boolean

      Whether the action can be structure cloned. If true, then the action should not be passed across message ports without special handling.