Support Forum       G3D Web Page     
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
G3D::XR::Controller Class Referenceabstract

Wand with buttons and joysticks or equivalent. More...

Inherits G3D::XR::Object.

Inherited by G3D::OpenVR::OpenVRController.

Public Member Functions

virtual float angleDelta (JoystickIndex s) const =0
 Value of the joystick axis a. More...
 
virtual bool currentlyDown (GKey b) const =0
 State (true = pressed, false = released) of the button at the end of the frame. More...
 
virtual Vector2 delta (JoystickIndex s) const =0
 
const CFrame & frame () const
 Where the AR/VR system estimates the object will be at the time of the next HMD::submit() call, in the room coordinate frame. More...
 
virtual bool hasPhysicalJoystick () const =0
 
virtual bool hasTouchpad () const =0
 
const int index () const
 Zero-based index in the XR::objectArray. More...
 
virtual bool isController () const override
 
virtual bool isHMD () const
 
virtual bool isLeft () const =0
 Is currently in the left hand. More...
 
virtual bool isRight () const =0
 Is currently in the right hand. More...
 
virtual bool justPressed (GKey b) const =0
 Was this button pressed at least once since the previous simulation frame? More...
 
virtual bool justReleased (GKey b) const =0
 Was this button released at least once since the previous simulation frame? More...
 
virtual String modelFilename () const =0
 Name of an .ArticulatedModel.Any file to use as the 3D representation of this controller. More...
 
const String & name () const
 Unique identifier. More...
 
int nativeAPIIndex () const
 Index of this object in the underlying OS API (e.g., OVR, OpenVR, SteamVR) More...
 
const CFrame & previousFrame () const
 Frame that was predicted at the previous HMD::submit() time. More...
 
virtual Vector2 stickPosition (JoystickIndex s) const =0
 

Static Public Member Functions

static shared_ptr< Object > create (int index, int nativeAPIIndex, const String &name)
 

Protected Member Functions

 Controller (int index, int nativeAPIIndex, const String &name)
 

Static Protected Member Functions

template<class T , class ... ArgTypes>
static shared_ptr< T > createShared (ArgTypes &&... args)
 Like std::make_shared, but works for protected constructors. More...
 

Protected Attributes

CFrame m_frame
 
int m_index
 
String m_name
 
int m_nativeAPIIndex
 
CFrame m_previousFrame
 

Detailed Description

Wand with buttons and joysticks or equivalent.

The order of button press and release within a frame is not available under this API, however, it is almost impossible for a human to press and release a button in 11 ms for a 90 Hz renderer so the distinction is likely irrelevant.

See also
G3D::GameController, G3D::UserInput, G3D::GEvent, G3D::XR::Hand

Constructor & Destructor Documentation

◆ Controller()

G3D::XR::Controller::Controller ( int  index,
int  nativeAPIIndex,
const String &  name 
)
inlineprotected

Member Function Documentation

◆ angleDelta()

virtual float G3D::XR::Controller::angleDelta ( JoystickIndex  s) const
pure virtual

Value of the joystick axis a.

Returns the counter-clockwise angle in radians that the stick has rotated through since the last HMD::submit

Implemented in G3D::OpenVR::OpenVRController.

◆ create()

static shared_ptr<Object> G3D::XR::Object::create ( int  index,
int  nativeAPIIndex,
const String &  name 
)
inlinestaticinherited

◆ createShared()

template<class T , class ... ArgTypes>
static shared_ptr<T> G3D::ReferenceCountedObject::createShared ( ArgTypes &&...  args)
inlinestaticprotectedinherited

Like std::make_shared, but works for protected constructors.

Call as createShared<myclass>.

◆ currentlyDown()

virtual bool G3D::XR::Controller::currentlyDown ( GKey  b) const
pure virtual

State (true = pressed, false = released) of the button at the end of the frame.

Implemented in G3D::OpenVR::OpenVRController.

◆ delta()

virtual Vector2 G3D::XR::Controller::delta ( JoystickIndex  s) const
pure virtual

◆ frame()

const CFrame& G3D::XR::Object::frame ( ) const
inlineinherited

Where the AR/VR system estimates the object will be at the time of the next HMD::submit() call, in the room coordinate frame.

◆ hasPhysicalJoystick()

virtual bool G3D::XR::Controller::hasPhysicalJoystick ( ) const
pure virtual
See also
hasTouchpad

Implemented in G3D::OpenVR::OpenVRController.

◆ hasTouchpad()

virtual bool G3D::XR::Controller::hasTouchpad ( ) const
pure virtual

◆ index()

const int G3D::XR::Object::index ( ) const
inlineinherited

◆ isController()

virtual bool G3D::XR::Controller::isController ( ) const
inlineoverridevirtual

Reimplemented from G3D::XR::Object.

◆ isHMD()

virtual bool G3D::XR::Object::isHMD ( ) const
inlinevirtualinherited

Reimplemented in G3D::XR::HMD.

◆ isLeft()

virtual bool G3D::XR::Controller::isLeft ( ) const
pure virtual

Is currently in the left hand.

Implemented in G3D::OpenVR::OpenVRController.

◆ isRight()

virtual bool G3D::XR::Controller::isRight ( ) const
pure virtual

Is currently in the right hand.

Implemented in G3D::OpenVR::OpenVRController.

◆ justPressed()

virtual bool G3D::XR::Controller::justPressed ( GKey  b) const
pure virtual

Was this button pressed at least once since the previous simulation frame?

Implemented in G3D::OpenVR::OpenVRController.

◆ justReleased()

virtual bool G3D::XR::Controller::justReleased ( GKey  b) const
pure virtual

Was this button released at least once since the previous simulation frame?

Implemented in G3D::OpenVR::OpenVRController.

◆ modelFilename()

virtual String G3D::XR::Controller::modelFilename ( ) const
pure virtual

Name of an .ArticulatedModel.Any file to use as the 3D representation of this controller.

Implemented in G3D::OpenVR::OpenVRController.

◆ name()

const String& G3D::XR::Object::name ( ) const
inlineinherited

◆ nativeAPIIndex()

int G3D::XR::Object::nativeAPIIndex ( ) const
inlineinherited

Index of this object in the underlying OS API (e.g., OVR, OpenVR, SteamVR)

Referenced by G3D::XR::Object::create(), G3D::EmulatedXR::EmulatedHMD::create(), and G3D::XR::Hand::create().

◆ previousFrame()

const CFrame& G3D::XR::Object::previousFrame ( ) const
inlineinherited

Frame that was predicted at the previous HMD::submit() time.

◆ stickPosition()

virtual Vector2 G3D::XR::Controller::stickPosition ( JoystickIndex  s) const
pure virtual

Member Data Documentation

◆ m_frame

CFrame G3D::XR::Object::m_frame
protectedinherited

Referenced by G3D::XR::Object::frame().

◆ m_index

int G3D::XR::Object::m_index
protectedinherited

Referenced by G3D::XR::Object::index().

◆ m_name

String G3D::XR::Object::m_name
protectedinherited

Referenced by G3D::XR::Object::name().

◆ m_nativeAPIIndex

int G3D::XR::Object::m_nativeAPIIndex
protectedinherited

◆ m_previousFrame

CFrame G3D::XR::Object::m_previousFrame
protectedinherited

documentation generated on Wed Nov 24 2021 08:02:02 using doxygen 1.8.15