diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-10-19 08:11:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-19 08:11:32 +0200 |
commit | 723b988fde777f68355160625580afedf40ba763 (patch) | |
tree | 6a25526622659aa481c340e47620cb57407b1373 /doc/classes | |
parent | fbd701a1283dc6d3c34ff5c2eff2f158f2a7c0bc (diff) | |
parent | 5d1ea92daf3eb2b9d7688b43568e8f2d0b7c0ab8 (diff) |
Merge pull request #52210 from BastiaanOlij/enhance_xr_trackers
Diffstat (limited to 'doc/classes')
-rw-r--r-- | doc/classes/XRAnchor3D.xml | 33 | ||||
-rw-r--r-- | doc/classes/XRController3D.xml | 68 | ||||
-rw-r--r-- | doc/classes/XRInterface.xml | 33 | ||||
-rw-r--r-- | doc/classes/XRInterfaceExtension.xml | 22 | ||||
-rw-r--r-- | doc/classes/XRNode3D.xml | 53 | ||||
-rw-r--r-- | doc/classes/XRPose.xml | 41 | ||||
-rw-r--r-- | doc/classes/XRPositionalTracker.xml | 121 | ||||
-rw-r--r-- | doc/classes/XRServer.xml | 31 |
8 files changed, 260 insertions, 142 deletions
diff --git a/doc/classes/XRAnchor3D.xml b/doc/classes/XRAnchor3D.xml index 94fc8fc13d..2c54c728ed 100644 --- a/doc/classes/XRAnchor3D.xml +++ b/doc/classes/XRAnchor3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="XRAnchor3D" inherits="Node3D" version="4.0"> +<class name="XRAnchor3D" inherits="XRNode3D" version="4.0"> <brief_description> An anchor point in AR space. </brief_description> @@ -11,24 +11,6 @@ <tutorials> </tutorials> <methods> - <method name="get_anchor_name" qualifiers="const"> - <return type="String" /> - <description> - Returns the name given to this anchor. - </description> - </method> - <method name="get_is_active" qualifiers="const"> - <return type="bool" /> - <description> - Returns [code]true[/code] if the anchor is being tracked and [code]false[/code] if no anchor with this ID is currently known. - </description> - </method> - <method name="get_mesh" qualifiers="const"> - <return type="Mesh" /> - <description> - If provided by the [XRInterface], this returns a mesh object for the anchor. For an anchor, this can be a shape related to the object being tracked or it can be a mesh that provides topology related to the anchor and can be used to create shadows/reflections on surfaces or for generating collision shapes. - </description> - </method> <method name="get_plane" qualifiers="const"> <return type="Plane" /> <description> @@ -42,17 +24,4 @@ </description> </method> </methods> - <members> - <member name="anchor_id" type="int" setter="set_anchor_id" getter="get_anchor_id" default="1"> - The anchor's ID. You can set this before the anchor itself exists. The first anchor gets an ID of [code]1[/code], the second an ID of [code]2[/code], etc. When anchors get removed, the engine can then assign the corresponding ID to new anchors. The most common situation where anchors "disappear" is when the AR server identifies that two anchors represent different parts of the same plane and merges them. - </member> - </members> - <signals> - <signal name="mesh_updated"> - <argument index="0" name="mesh" type="Mesh" /> - <description> - Emitted when the mesh associated with the anchor changes or when one becomes available. This is especially important for topology that is constantly being [code]mesh_updated[/code]. - </description> - </signal> - </signals> </class> diff --git a/doc/classes/XRController3D.xml b/doc/classes/XRController3D.xml index 35edf5c2b2..eb91196e00 100644 --- a/doc/classes/XRController3D.xml +++ b/doc/classes/XRController3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="XRController3D" inherits="Node3D" version="4.0"> +<class name="XRController3D" inherits="XRNode3D" version="4.0"> <brief_description> A spatial node representing a spatially-tracked controller. </brief_description> @@ -7,63 +7,41 @@ This is a helper spatial node that is linked to the tracking of controllers. It also offers several handy passthroughs to the state of buttons and such on the controllers. Controllers are linked by their ID. You can create controller nodes before the controllers are available. If your game always uses two controllers (one for each hand), you can predefine the controllers with ID 1 and 2; they will become active as soon as the controllers are identified. If you expect additional controllers to be used, you should react to the signals and add XRController3D nodes to your scene. The position of the controller node is automatically updated by the [XRServer]. This makes this node ideal to add child nodes to visualize the controller. + As many XR runtimes now use a configurable action map all inputs are named. </description> <tutorials> <link title="VR documentation index">https://docs.godotengine.org/en/latest/tutorials/vr/index.html</link> </tutorials> <methods> - <method name="get_controller_name" qualifiers="const"> - <return type="String" /> + <method name="get_axis" qualifiers="const"> + <return type="Vector2" /> + <argument index="0" name="name" type="StringName" /> <description> - If active, returns the name of the associated controller if provided by the AR/VR SDK used. + Returns a [Vector2] for the input with the given [code]name[/code]. This is used for thumbsticks and thumbpads found on many controllers. </description> </method> - <method name="get_is_active" qualifiers="const"> - <return type="bool" /> + <method name="get_tracker_hand" qualifiers="const"> + <return type="int" enum="XRPositionalTracker.TrackerHand" /> <description> - Returns [code]true[/code] if the bound controller is active. XR systems attempt to track active controllers. + Returns the hand holding this controller, if known. See [enum XRPositionalTracker.TrackerHand]. </description> </method> - <method name="get_joystick_axis" qualifiers="const"> + <method name="get_value" qualifiers="const"> <return type="float" /> - <argument index="0" name="axis" type="int" /> - <description> - Returns the value of the given axis for things like triggers, touchpads, etc. that are embedded into the controller. - </description> - </method> - <method name="get_joystick_id" qualifiers="const"> - <return type="int" /> - <description> - Returns the ID of the joystick object bound to this. Every controller tracked by the [XRServer] that has buttons and axis will also be registered as a joystick within Godot. This means that all the normal joystick tracking and input mapping will work for buttons and axis found on the AR/VR controllers. This ID is purely offered as information so you can link up the controller with its joystick entry. - </description> - </method> - <method name="get_mesh" qualifiers="const"> - <return type="Mesh" /> + <argument index="0" name="name" type="StringName" /> <description> - If provided by the [XRInterface], this returns a mesh associated with the controller. This can be used to visualize the controller. - </description> - </method> - <method name="get_tracker_hand" qualifiers="const"> - <return type="int" enum="XRPositionalTracker.TrackerHand" /> - <description> - Returns the hand holding this controller, if known. See [enum XRPositionalTracker.TrackerHand]. + Returns a numeric value for the input with the given [code]name[/code]. This is used for triggers and grip sensors. </description> </method> <method name="is_button_pressed" qualifiers="const"> <return type="bool" /> - <argument index="0" name="button" type="int" /> + <argument index="0" name="name" type="StringName" /> <description> - Returns [code]true[/code] if the button at index [code]button[/code] is pressed. See [enum JoyButton]. + Returns [code]true[/code] if the button with the given [code]name[/code] is pressed. </description> </method> </methods> <members> - <member name="controller_id" type="int" setter="set_controller_id" getter="get_controller_id" default="1"> - The controller's ID. - A controller ID of 0 is unbound and will always result in an inactive node. Controller ID 1 is reserved for the first controller that identifies itself as the left-hand controller and ID 2 is reserved for the first controller that identifies itself as the right-hand controller. - For any other controller that the [XRServer] detects, we continue with controller ID 3. - When a controller is turned off, its slot is freed. This ensures controllers will keep the same ID even when controllers with lower IDs are turned off. - </member> <member name="rumble" type="float" setter="set_rumble" getter="get_rumble" default="0.0"> The degree to which the controller vibrates. Ranges from [code]0.0[/code] to [code]1.0[/code] with precision [code].01[/code]. If changed, updates [member XRPositionalTracker.rumble] accordingly. This is a useful property to animate if you want the controller to vibrate for a limited duration. @@ -71,21 +49,29 @@ </members> <signals> <signal name="button_pressed"> - <argument index="0" name="button" type="int" /> + <argument index="0" name="name" type="String" /> <description> Emitted when a button on this controller is pressed. </description> </signal> <signal name="button_released"> - <argument index="0" name="button" type="int" /> + <argument index="0" name="name" type="String" /> <description> Emitted when a button on this controller is released. </description> </signal> - <signal name="mesh_updated"> - <argument index="0" name="mesh" type="Mesh" /> + <signal name="input_axis_changed"> + <argument index="0" name="name" type="String" /> + <argument index="1" name="value" type="Vector2" /> + <description> + Emitted when a thumbstick or thumbpad on this controller is moved. + </description> + </signal> + <signal name="input_value_changed"> + <argument index="0" name="name" type="String" /> + <argument index="1" name="value" type="float" /> <description> - Emitted when the mesh associated with the controller changes or when one becomes available. Generally speaking this will be a static mesh after becoming available. + Emitted when a trigger or similar input on this controller changes value. </description> </signal> </signals> diff --git a/doc/classes/XRInterface.xml b/doc/classes/XRInterface.xml index ffc2bc138d..27713498ee 100644 --- a/doc/classes/XRInterface.xml +++ b/doc/classes/XRInterface.xml @@ -63,6 +63,20 @@ Is [code]true[/code] if this interface has been initialised. </description> </method> + <method name="trigger_haptic_pulse"> + <return type="void" /> + <argument index="0" name="action_name" type="String" /> + <argument index="1" name="tracker_name" type="StringName" /> + <argument index="2" name="frequency" type="float" /> + <argument index="3" name="amplitude" type="float" /> + <argument index="4" name="duration_sec" type="float" /> + <argument index="5" name="delay_sec" type="float" /> + <description> + Triggers a haptic pulse on a device associated with this interface. + [code]action_name[/code] is the name of the action for this pulse. + [code]tracker_name[/code] is optional and can be used to direct the pulse to a specific device provided that device is bound to this haptic. + </description> + </method> <method name="uninitialize"> <return type="void" /> <description> @@ -88,20 +102,17 @@ <constant name="XR_STEREO" value="2" enum="Capabilities"> This interface supports stereoscopic rendering. </constant> - <constant name="XR_AR" value="4" enum="Capabilities"> - This interface supports AR (video background and real world tracking). + <constant name="XR_QUAD" value="4" enum="Capabilities"> + This interface supports quad rendering (not yet supported by Godot). </constant> - <constant name="XR_EXTERNAL" value="8" enum="Capabilities"> - This interface outputs to an external device. If the main viewport is used, the on screen output is an unmodified buffer of either the left or right eye (stretched if the viewport size is not changed to the same aspect ratio of [method get_render_target_size]). Using a separate viewport node frees up the main viewport for other purposes. - </constant> - <constant name="EYE_MONO" value="0" enum="Eyes"> - Mono output, this is mostly used internally when retrieving positioning information for our camera node or when stereo scopic rendering is not supported. + <constant name="XR_VR" value="8" enum="Capabilities"> + this interface supports VR. </constant> - <constant name="EYE_LEFT" value="1" enum="Eyes"> - Left eye output, this is mostly used internally when rendering the image for the left eye and obtaining positioning and projection information. + <constant name="XR_AR" value="16" enum="Capabilities"> + This interface supports AR (video background and real world tracking). </constant> - <constant name="EYE_RIGHT" value="2" enum="Eyes"> - Right eye output, this is mostly used internally when rendering the image for the right eye and obtaining positioning and projection information. + <constant name="XR_EXTERNAL" value="32" enum="Capabilities"> + This interface outputs to an external device. If the main viewport is used, the on screen output is an unmodified buffer of either the left or right eye (stretched if the viewport size is not changed to the same aspect ratio of [method get_render_target_size]). Using a separate viewport node frees up the main viewport for other purposes. </constant> <constant name="XR_NORMAL_TRACKING" value="0" enum="TrackingStatus"> Tracking is behaving as expected. diff --git a/doc/classes/XRInterfaceExtension.xml b/doc/classes/XRInterfaceExtension.xml index 84b46e0ddd..4328488ced 100644 --- a/doc/classes/XRInterfaceExtension.xml +++ b/doc/classes/XRInterfaceExtension.xml @@ -55,6 +55,17 @@ <description> </description> </method> + <method name="_get_suggested_pose_names" qualifiers="virtual const"> + <return type="PackedStringArray" /> + <argument index="0" name="tracker_name" type="StringName" /> + <description> + </description> + </method> + <method name="_get_suggested_tracker_names" qualifiers="virtual const"> + <return type="PackedStringArray" /> + <description> + </description> + </method> <method name="_get_tracking_status" qualifiers="virtual const"> <return type="int" /> <description> @@ -99,6 +110,17 @@ <description> </description> </method> + <method name="_trigger_haptic_pulse" qualifiers="virtual"> + <return type="void" /> + <argument index="0" name="action_name" type="String" /> + <argument index="1" name="tracker_name" type="StringName" /> + <argument index="2" name="frequency" type="float" /> + <argument index="3" name="amplitude" type="float" /> + <argument index="4" name="duration_sec" type="float" /> + <argument index="5" name="delay_sec" type="float" /> + <description> + </description> + </method> <method name="_uninitialize" qualifiers="virtual"> <return type="void" /> <description> diff --git a/doc/classes/XRNode3D.xml b/doc/classes/XRNode3D.xml new file mode 100644 index 0000000000..2e6d11d729 --- /dev/null +++ b/doc/classes/XRNode3D.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="XRNode3D" inherits="Node3D" version="4.0"> + <brief_description> + A spatial node that has its position automatically updated by the [XRServer]. + </brief_description> + <description> + This node can be bound to a specific pose of a [XRPositionalTracker] and will automatically have its [member Node3D.transform] updated by the [XRServer]. Nodes of this type must be added as children of the [XROrigin3D] node. + </description> + <tutorials> + </tutorials> + <methods> + <method name="get_has_tracking_data" qualifiers="const"> + <return type="bool" /> + <description> + Returns [code]true[/code] if the [member tracker] has current tracking data for the [member pose] being tracked. + </description> + </method> + <method name="get_is_active" qualifiers="const"> + <return type="bool" /> + <description> + Returns [code]true[/code] if the [member tracker] has been registered and the [member pose] is being tracked. + </description> + </method> + <method name="get_pose"> + <return type="XRPose" /> + <description> + Returns the [XRPose] containing the current state of the pose being tracked. This gives access to additional properties of this pose. + </description> + </method> + <method name="trigger_haptic_pulse"> + <return type="void" /> + <argument index="0" name="action_name" type="String" /> + <argument index="1" name="frequency" type="float" /> + <argument index="2" name="amplitude" type="float" /> + <argument index="3" name="duration_sec" type="float" /> + <argument index="4" name="delay_sec" type="float" /> + <description> + Triggers a haptic pulse on a device associated with this interface. + [code]action_name[/code] is the name of the action for this pulse. + </description> + </method> + </methods> + <members> + <member name="pose" type="StringName" setter="set_pose_name" getter="get_pose_name" default="&"default""> + The name of the pose we're bound to. Which poses a tracker supports is not known during design time. + Godot defines number of standard pose names such as [code]aim[/code] and [code]grip[/code] but other may be configured within a given [XRInterface]. + </member> + <member name="tracker" type="StringName" setter="set_tracker" getter="get_tracker" default="&"""> + The name of the tracker we're bound to. Which trackers are available is not known during design time. + Godot defines a number of standard trackers such as [code]left_hand[/code] and [code]right_hand[/code] but others may be configured within a given [XRInterface]. + </member> + </members> +</class> diff --git a/doc/classes/XRPose.xml b/doc/classes/XRPose.xml new file mode 100644 index 0000000000..0de2bc9e48 --- /dev/null +++ b/doc/classes/XRPose.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="XRPose" inherits="RefCounted" version="4.0"> + <brief_description> + This object contains all data related to a pose on a tracked object. + </brief_description> + <description> + XR runtimes often identify multiple locations on devices such as controllers that are spatially tracked. + Orientation, location, linear velocity and angular velocity are all provided for each pose by the XR runtime. This object contains this state of a pose. + </description> + <tutorials> + </tutorials> + <methods> + <method name="get_adjusted_transform" qualifiers="const"> + <return type="Transform3D" /> + <description> + Returns the [member transform] with world scale and our reference frame applied. This is the transform used to position [XRNode3D] objects. + </description> + </method> + </methods> + <members> + <member name="angular_velocity" type="Vector3" setter="set_angular_velocity" getter="get_angular_velocity" default="Vector3(0, 0, 0)"> + The angular velocity for this pose. + </member> + <member name="has_tracking_data" type="bool" setter="set_has_tracking_data" getter="get_has_tracking_data" default="false"> + If [code]true[/code] our tracking data is up to date. If [code]false[/code] we're no longer receiving new tracking data and our state is whatever that last valid state was. + </member> + <member name="linear_velocity" type="Vector3" setter="set_linear_velocity" getter="get_linear_velocity" default="Vector3(0, 0, 0)"> + The linear velocity of this pose. + </member> + <member name="name" type="StringName" setter="set_name" getter="get_name" default="&"""> + The name of this pose. Pose names are often driven by an action map setup by the user. Godot does suggest a number of pose names that it expects [XRInterface]s to implement: + - [code]root[/code] defines a root location, often used for tracked objects that do not have further nodes. + - [code]aim[/code] defines the tip of a controller with the orientation pointing outwards, for instance: add your raycasts to this. + - [code]grip[/code] defines the location where the user grips the controller + - [code]skeleton[/code] defines the root location a hand mesh should be placed when using hand tracking and the animated skeleton supplied by the XR runtime. + </member> + <member name="transform" type="Transform3D" setter="set_transform" getter="get_transform" default="Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)"> + The transform containing the original and transform as reported by the XR runtime. + </member> + </members> +</class> diff --git a/doc/classes/XRPositionalTracker.xml b/doc/classes/XRPositionalTracker.xml index d231bfde74..bd6a518835 100644 --- a/doc/classes/XRPositionalTracker.xml +++ b/doc/classes/XRPositionalTracker.xml @@ -5,86 +5,113 @@ </brief_description> <description> An instance of this object represents a device that is tracked, such as a controller or anchor point. HMDs aren't represented here as they are handled internally. - As controllers are turned on and the AR/VR interface detects them, instances of this object are automatically added to this list of active tracking objects accessible through the [XRServer]. - The [XRController3D] and [XRAnchor3D] both consume objects of this type and should be used in your project. The positional trackers are just under-the-hood objects that make this all work. These are mostly exposed so that GDNative-based interfaces can interact with them. + As controllers are turned on and the [XRInterface] detects them, instances of this object are automatically added to this list of active tracking objects accessible through the [XRServer]. + The [XRController3D] and [XRAnchor3D] both consume objects of this type and should be used in your project. The positional trackers are just under-the-hood objects that make this all work. These are mostly exposed so that GDExtension-based interfaces can interact with them. </description> <tutorials> <link title="VR documentation index">https://docs.godotengine.org/en/latest/tutorials/vr/index.html</link> </tutorials> <methods> - <method name="get_joy_id" qualifiers="const"> - <return type="int" /> + <method name="get_input" qualifiers="const"> + <return type="Variant" /> + <argument index="0" name="name" type="StringName" /> <description> - If this is a controller that is being tracked, the controller will also be represented by a joystick entry with this ID. + Returns an input for this tracker. It can return a boolean, float or [Vector2] value depending on whether the input is a button, trigger or thumbstick/thumbpad. </description> </method> - <method name="get_mesh" qualifiers="const"> - <return type="Mesh" /> + <method name="get_pose" qualifiers="const"> + <return type="XRPose" /> + <argument index="0" name="name" type="StringName" /> <description> - Returns the mesh related to a controller or anchor point if one is available. + Returns the current [XRPose] state object for the bound [code]pose[/code]. </description> </method> - <method name="get_orientation" qualifiers="const"> - <return type="Basis" /> + <method name="has_pose" qualifiers="const"> + <return type="bool" /> + <argument index="0" name="name" type="StringName" /> <description> - Returns the controller's orientation matrix. + Returns [code]true[/code] if the bound [code]tracker[/code] is available and is currently tracking the bound [code]pose[/code]. </description> </method> - <method name="get_position" qualifiers="const"> - <return type="Vector3" /> + <method name="invalidate_pose"> + <return type="void" /> + <argument index="0" name="name" type="StringName" /> <description> - Returns the world-space controller position. + Marks this pose as invalid, we don't clear the last reported state but it allows users to decide if trackers need to be hidden if we loose tracking or just remain at their last known position. </description> </method> - <method name="get_tracker_hand" qualifiers="const"> - <return type="int" enum="XRPositionalTracker.TrackerHand" /> + <method name="set_input"> + <return type="void" /> + <argument index="0" name="name" type="StringName" /> + <argument index="1" name="value" type="Variant" /> <description> - Returns the hand holding this tracker, if known. See [enum TrackerHand] constants. + Changes the value for the given input. This method is called by a [XRInterface] implementation and should not be used directly. </description> </method> - <method name="get_tracker_id" qualifiers="const"> - <return type="int" /> + <method name="set_pose"> + <return type="void" /> + <argument index="0" name="name" type="StringName" /> + <argument index="1" name="transform" type="Transform3D" /> + <argument index="2" name="linear_velocity" type="Vector3" /> + <argument index="3" name="angular_velocity" type="Vector3" /> <description> - Returns the internal tracker ID. This uniquely identifies the tracker per tracker type and matches the ID you need to specify for nodes such as the [XRController3D] and [XRAnchor3D] nodes. + Sets the transform, linear velocity and angular velocity for the given pose. This method is called by a [XRInterface] implementation and should not be used directly. </description> </method> - <method name="get_tracker_name" qualifiers="const"> - <return type="StringName" /> + </methods> + <members> + <member name="description" type="String" setter="set_tracker_desc" getter="get_tracker_desc" default=""""> + The description of this tracker. + </member> + <member name="hand" type="int" setter="set_tracker_hand" getter="get_tracker_hand" enum="XRPositionalTracker.TrackerHand" default="0"> + Defines which hand this tracker relates to. + </member> + <member name="name" type="StringName" setter="set_tracker_name" getter="get_tracker_name" default="&"Unknown""> + The unique name of this tracker. The trackers that are available differ between various XR runtimes and can often be configured by the user. Godot maintains a number of reserved names that it expects the [XRInterface] to implement if applicable: + - [code]left_hand[/code] identifies the controller held in the players left hand + - [code]right_hand[/code] identifies the controller held in the players right hand + </member> + <member name="rumble" type="float" setter="set_rumble" getter="get_rumble" default="0.0"> + The degree to which the tracker rumbles. Ranges from [code]0.0[/code] to [code]1.0[/code] with precision [code].01[/code]. + </member> + <member name="type" type="int" setter="set_tracker_type" getter="get_tracker_type" enum="XRServer.TrackerType" default="128"> + The type of tracker. + </member> + </members> + <signals> + <signal name="button_pressed"> + <argument index="0" name="name" type="String" /> <description> - Returns the controller or anchor point's name, if applicable. + Emitted when a button on this tracker is pressed. Note that many XR runtimes allow other inputs to be mapped to buttons. </description> - </method> - <method name="get_tracker_type" qualifiers="const"> - <return type="int" enum="XRServer.TrackerType" /> + </signal> + <signal name="button_released"> + <argument index="0" name="name" type="String" /> <description> - Returns the tracker's type, which will be one of the values from the [enum XRServer.TrackerType] enum. + Emitted when a button on this tracker is released. </description> - </method> - <method name="get_transform" qualifiers="const"> - <return type="Transform3D" /> - <argument index="0" name="adjust_by_reference_frame" type="bool" /> + </signal> + <signal name="input_axis_changed"> + <argument index="0" name="name" type="String" /> + <argument index="1" name="vector" type="Vector2" /> <description> - Returns the transform combining this device's orientation and position. + Emitted when a thumbstick or thumbpad on this tracker moves. </description> - </method> - <method name="is_tracking_orientation" qualifiers="const"> - <return type="bool" /> + </signal> + <signal name="input_value_changed"> + <argument index="0" name="name" type="String" /> + <argument index="1" name="value" type="float" /> <description> - Returns [code]true[/code] if this device is tracking orientation. + Emitted when a trigger or similar input on this tracker changes value. </description> - </method> - <method name="is_tracking_position" qualifiers="const"> - <return type="bool" /> + </signal> + <signal name="pose_changed"> + <argument index="0" name="pose" type="XRPose" /> <description> - Returns [code]true[/code] if this device is tracking position. + Emitted when the state of a pose tracked by this tracker changes. </description> - </method> - </methods> - <members> - <member name="rumble" type="float" setter="set_rumble" getter="get_rumble" default="0.0"> - The degree to which the tracker rumbles. Ranges from [code]0.0[/code] to [code]1.0[/code] with precision [code].01[/code]. - </member> - </members> + </signal> + </signals> <constants> <constant name="TRACKER_HAND_UNKNOWN" value="0" enum="TrackerHand"> The hand this tracker is held in is unknown or not applicable. diff --git a/doc/classes/XRServer.xml b/doc/classes/XRServer.xml index 0929094fd1..87164ebb52 100644 --- a/doc/classes/XRServer.xml +++ b/doc/classes/XRServer.xml @@ -90,20 +90,21 @@ <method name="get_reference_frame" qualifiers="const"> <return type="Transform3D" /> <description> - Returns the reference frame transform. Mostly used internally and exposed for GDNative build interfaces. + Returns the reference frame transform. Mostly used internally and exposed for GDExtension build interfaces. </description> </method> <method name="get_tracker" qualifiers="const"> <return type="XRPositionalTracker" /> - <argument index="0" name="idx" type="int" /> + <argument index="0" name="tracker_name" type="StringName" /> <description> - Returns the positional tracker at the given ID. + Returns the positional tracker with this name. </description> </method> - <method name="get_tracker_count" qualifiers="const"> - <return type="int" /> + <method name="get_trackers"> + <return type="Dictionary" /> + <argument index="0" name="tracker_types" type="int" /> <description> - Returns the number of trackers currently registered. + Returns a dictionary of trackers for this type. </description> </method> <method name="remove_interface"> @@ -145,7 +146,6 @@ <signal name="tracker_added"> <argument index="0" name="tracker_name" type="StringName" /> <argument index="1" name="type" type="int" /> - <argument index="2" name="id" type="int" /> <description> Emitted when a new tracker has been added. If you don't use a fixed number of controllers or if you're using [XRAnchor3D]s for an AR solution, it is important to react to this signal to add the appropriate [XRController3D] or [XRAnchor3D] nodes related to this new tracker. </description> @@ -153,20 +153,29 @@ <signal name="tracker_removed"> <argument index="0" name="tracker_name" type="StringName" /> <argument index="1" name="type" type="int" /> - <argument index="2" name="id" type="int" /> <description> Emitted when a tracker is removed. You should remove any [XRController3D] or [XRAnchor3D] points if applicable. This is not mandatory, the nodes simply become inactive and will be made active again when a new tracker becomes available (i.e. a new controller is switched on that takes the place of the previous one). </description> </signal> + <signal name="tracker_updated"> + <argument index="0" name="tracker_name" type="StringName" /> + <argument index="1" name="type" type="int" /> + <description> + Emitted when an existing tracker has been updated. This can happen if the user switches controllers. + </description> + </signal> </signals> <constants> - <constant name="TRACKER_CONTROLLER" value="1" enum="TrackerType"> + <constant name="TRACKER_HEAD" value="1" enum="TrackerType"> + The tracker tracks the location of the players head. This is usually a location centered between the players eyes. Note that for handheld AR devices this can be the current location of the device. + </constant> + <constant name="TRACKER_CONTROLLER" value="2" enum="TrackerType"> The tracker tracks the location of a controller. </constant> - <constant name="TRACKER_BASESTATION" value="2" enum="TrackerType"> + <constant name="TRACKER_BASESTATION" value="4" enum="TrackerType"> The tracker tracks the location of a base station. </constant> - <constant name="TRACKER_ANCHOR" value="4" enum="TrackerType"> + <constant name="TRACKER_ANCHOR" value="8" enum="TrackerType"> The tracker tracks the location and size of an AR anchor. </constant> <constant name="TRACKER_ANY_KNOWN" value="127" enum="TrackerType"> |