XRInterface

Inherits: RefCounted < Object

Inherited By: MobileVRInterface, OpenXRInterface, WebXRInterface, XRInterfaceExtension

Base class for an XR interface implementation.

Description

This class needs to be implemented to make an AR or VR platform available to Godot and these should be implemented as C++ modules or GDExtension modules. Part of the interface is exposed to GDScript so you can detect, enable and configure an AR or VR platform.

Interfaces should be written in such a way that simply enabling them will give us a working setup. You can query the available interfaces through XRServer.

Tutorials

Properties

bool

ar_is_anchor_detection_enabled

false

EnvironmentBlendMode

environment_blend_mode

0

bool

interface_is_primary

false

PlayAreaMode

xr_play_area_mode

0

Methods

int

get_camera_feed_id ( )

int

get_capabilities ( ) const

StringName

get_name ( ) const

PackedVector3Array

get_play_area ( ) const

Projection

get_projection_for_view ( int view, float aspect, float near, float far )

Vector2

get_render_target_size ( )

Array

get_supported_environment_blend_modes ( )

Dictionary

get_system_info ( )

TrackingStatus

get_tracking_status ( ) const

Transform3D

get_transform_for_view ( int view, Transform3D cam_transform )

int

get_view_count ( )

bool

initialize ( )

bool

is_initialized ( ) const

bool

is_passthrough_enabled ( )

bool

is_passthrough_supported ( )

bool

set_environment_blend_mode ( EnvironmentBlendMode mode )

bool

set_play_area_mode ( PlayAreaMode mode )

bool

start_passthrough ( )

void

stop_passthrough ( )

bool

supports_play_area_mode ( PlayAreaMode mode )

void

trigger_haptic_pulse ( String action_name, StringName tracker_name, float frequency, float amplitude, float duration_sec, float delay_sec )

void

uninitialize ( )


Signals

play_area_changed ( int mode )

Emitted when the play area is changed. This can be a result of the player resetting the boundary or entering a new play area, the player changing the play area mode, the world scale changing or the player resetting their headset orientation.


Enumerations

enum Capabilities:

Capabilities XR_NONE = 0

No XR capabilities.

Capabilities XR_MONO = 1

This interface can work with normal rendering output (non-HMD based AR).

Capabilities XR_STEREO = 2

This interface supports stereoscopic rendering.

Capabilities XR_QUAD = 4

This interface supports quad rendering (not yet supported by Godot).

Capabilities XR_VR = 8

This interf