XRController3D

package
v0.0.0-...-fa94a0d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2025 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

This is a helper 3D 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.

The current XRInterface defines the names of inputs. In the case of OpenXR, these are the names of actions in the current action set from the OpenXR action map.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsXRController3D() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsNode3D

func (self *Extension[T]) AsNode3D() Node3D.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsXRController3D

func (self *Extension[T]) AsXRController3D() Instance

func (*Extension[T]) AsXRNode3D

func (self *Extension[T]) AsXRNode3D() XRNode3D.Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.XRController3D

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsNode3D

func (self Instance) AsNode3D() Node3D.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsXRController3D

func (self Instance) AsXRController3D() Instance

func (Instance) AsXRNode3D

func (self Instance) AsXRNode3D() XRNode3D.Instance

func (Instance) GetFloat

func (self Instance) GetFloat(name string) Float.X

Returns a numeric value for the input with the given 'name'. This is used for triggers and grip sensors.

Note: The current XRInterface defines the 'name' for each input. In the case of OpenXR, these are the names of actions in the current action set.

func (Instance) GetInput

func (self Instance) GetInput(name string) any

Returns a any for the input with the given 'name'. This works for any input type, the variant will be typed according to the actions configuration.

Note: The current XRInterface defines the 'name' for each input. In the case of OpenXR, these are the names of actions in the current action set.

func (Instance) GetTrackerHand

func (self Instance) GetTrackerHand() XRPositionalTracker.TrackerHand

Returns the hand holding this controller, if known.

func (Instance) GetVector2

func (self Instance) GetVector2(name string) Vector2.XY

Returns a Vector2.XY for the input with the given 'name'. This is used for thumbsticks and thumbpads found on many controllers.

Note: The current XRInterface defines the 'name' for each input. In the case of OpenXR, these are the names of actions in the current action set.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) IsButtonPressed

func (self Instance) IsButtonPressed(name string) bool

Returns true if the button with the given 'name' is pressed.

Note: The current XRInterface defines the 'name' for each input. In the case of OpenXR, these are the names of actions in the current action set.

func (Instance) OnButtonPressed

func (self Instance) OnButtonPressed(cb func(name string), flags ...Signal.Flags)

func (Instance) OnButtonReleased

func (self Instance) OnButtonReleased(cb func(name string), flags ...Signal.Flags)

func (Instance) OnInputFloatChanged

func (self Instance) OnInputFloatChanged(cb func(name string, value Float.X), flags ...Signal.Flags)

func (Instance) OnInputVector2Changed

func (self Instance) OnInputVector2Changed(cb func(name string, value Vector2.XY), flags ...Signal.Flags)

func (Instance) OnProfileChanged

func (self Instance) OnProfileChanged(cb func(role string), flags ...Signal.Flags)

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL