Game Controller

namespace ovidVR::GameController

namespace ovidVR::GameController::Network

namespace ovidVR::GameController

Summary

enum ControllerDOF

class ovidVR::GameController::AudioController Controls the sounds used for each action in the application class ovidVR::GameController::DeviceController This must be overriden by each controller class ovidVR::GameController::OvidVRControllerClass This class is the link between the device manager and network manager The Device manager needs to be overriden for each controller type

Members

enum ControllerDOF

TwoDOF
ThreeDOF
SixDOF

class ovidVR::GameController::AudioController

class ovidVR::GameController::AudioController
  : public MonoBehaviour

Controls the sounds used for each action in the application

Summary

{property} AudioController [Get] (#classovid_v_r_1_1_game_controller_1_1_audio_controller_1ae47ce91b9223f780ba2df0a15d6f1dcd)

public inline void ResetAudio() Resets the audio source properties public inline void PlayPerform() Play ‘perform’ sound public inline void PlayError() Play ‘error’ sound public inline void PlayCriticalError() Play ‘critical error’ sound public inline void PlayUndo() Play ‘undo’ sound protected inline  AudioController()

Members

{property} AudioController Get
public inline void ResetAudio()

Resets the audio source properties

public inline void PlayPerform()

Play ‘perform’ sound

public inline void PlayError()

Play ‘error’ sound

public inline void PlayCriticalError()

Play ‘critical error’ sound

public inline void PlayUndo()

Play ‘undo’ sound

protected inline  AudioController()

class ovidVR::GameController::DeviceController

class ovidVR::GameController::DeviceController
  : public MonoBehaviour

This must be overriden by each controller

Summary

public ControllerDOF DOF Current DeviceController degrees of freedom

public inline virtual Material GetThumpStickMaterial(OvidVRControllerClass.OvidVRHand _hand) Controller Material functions that returns the material of the “_hand” thumpstick/trackpad

public inline virtual void SetThumpSticMaterial(OvidVRControllerClass.OvidVRHand _hand,Material mat) Sets the material of the thumpstick or trackpad

public abstract void SetHandColor(Color _handColor,float _flashSpeed,OvidVRControllerClass.OvidVRHand _hand) Sets the Color of the desired hand

public abstract void ResetHandsColor() Resets the color of both hands and stops the flashing

public abstract void SetDefaultHandsColor(Color _color) Sets the default color for both hands

public abstract void SetControllerState(OvidVRControllerClass.OvidVRHand _hand,bool state) Sets the state of the controller (enable or disabled)

public abstract void SetLeftHandTransparency(float _alpha)

public abstract void SetRightHandTransparency(float _alpha)

public abstract void SetMenuButtonFlashing(OvidVRControllerClass.OvidVRHand _hand)

public abstract void StopMenuButtonFlashing(OvidVRControllerClass.OvidVRHand _hand)

public abstract void SetButtonFlashing(bool _enabled,OvidVRControllerClass.OvidVRHand_hand,paramsOvidVRControllerClass.OvidVRControllerButtons _buttons) Sets a flashing animation to the given buttons

public abstract void SetHandTransparency(float _alpha,OvidVRControllerClass.OvidVRHand _hand) Sets hand transparency

public abstract bool MovementEnabled(OvidVRControllerClass.OvidVRHand _hand)

public abstract bool IsMoving()

public abstract bool GetTrackPadPressed(OvidVRControllerClass.OvidVRHand _hand) Gets the trackpad/thumpstick current state

public abstract bool GetTriggerPressed(OvidVRControllerClass.OvidVRHand _hand) Gets the trigger current state

public abstract bool GetGripPressed(OvidVRControllerClass.OvidVRHand _hand) Gets the grip state

public inline virtual OvidVRControllerClass.ControllerTypes GetControllerType() Gets the state of the controller

public inline virtual void SetControllerType(OvidVRControllerClass.ControllerTypes _controllerTypes) Sets the controller state

public abstract float GetControllerGrabStrength(OvidVRControllerClass.OvidVRHand _hand) Function to get the controllers grab strength value.

public abstract string GetHandTag(GameObject child) Get a string representation of the hand tag

public abstract Transform GetHandTransform(GameObject child) Returns the Transform of the current controllers hand gameobject

public abstract void ControllerHapticPulse(OvidVRControllerClass.OvidVRHand _hand,float strength,float _freq,float _duration) Creates a haptic pulse on vive controller

public abstract bool GetIsGrabed(OvidVRControllerClass.OvidVRHand _hand) Get the state if the grip button is pressed

public abstract void SetBothControllersConnection(bool _bothContrConnected)

public abstract Vector2 GetThumpPosOnController(OvidVRControllerClass.OvidVRHand _hand) Returns the position of the thump

public abstract OvidVRControllerClass.OvidVRControllerButtons GetPressedButtons() Sees which buttons are pressed

Members

public ControllerDOF DOF

Current DeviceController degrees of freedom

public inline virtual Material GetThumpStickMaterial(OvidVRControllerClass.OvidVRHand _hand)

Controller Material functions that returns the material of the “_hand” thumpstick/trackpad

Parameters
  • hand

Returns

Returns the thumpstick/trackpad material

public inline virtual void SetThumpSticMaterial(OvidVRControllerClass.OvidVRHand _hand,Material mat)

Sets the material of the thumpstick or trackpad

Parameters
  • _hand Which hand

  • mat Material to set

public abstract void SetHandColor(Color _handColor,float _flashSpeed,OvidVRControllerClass.OvidVRHand _hand)

Sets the Color of the desired hand

Parameters
  • _hand

  • _handColor

  • _flashSpeed

public abstract void ResetHandsColor()

Resets the color of both hands and stops the flashing

public abstract void SetDefaultHandsColor(Color _color)

Sets the default color for both hands

Parameters
  • _color

public abstract void SetControllerState(OvidVRControllerClass.OvidVRHand _hand,bool state)

Sets the state of the controller (enable or disabled)

Parameters
  • _hand

  • state true -> enabled

public abstract void SetLeftHandTransparency(float _alpha)
public abstract void SetRightHandTransparency(float _alpha)
public abstract void SetButtonFlashing(bool _enabled,OvidVRControllerClass.OvidVRHand_hand,paramsOvidVRControllerClass.OvidVRControllerButtons _buttons)

Sets a flashing animation to the given buttons

Parameters
  • _enabled Enable OR disable flashing animation

  • _hand The hand to use

  • _buttons Array or list of buttons to use

public abstract void SetHandTransparency(float _alpha,OvidVRControllerClass.OvidVRHand _hand)

Sets hand transparency

Parameters
  • _alpha Transparency Value

  • _hand Hand: left OR right

public abstract bool IsMoving()
public abstract bool GetTrackPadPressed(OvidVRControllerClass.OvidVRHand _hand)

Gets the trackpad/thumpstick current state

Parameters
  • _hand

Returns

Returns true if the thumpstick/trackpad is pressed

public abstract bool GetTriggerPressed(OvidVRControllerClass.OvidVRHand _hand)

Gets the trigger current state

Parameters
  • _hand

Returns

Returns trus if trigger is pressed

public abstract bool GetGripPressed(OvidVRControllerClass.OvidVRHand _hand)

Gets the grip state

Parameters
  • _hand

Returns

Returns true if grip buttons is pressed

public inline virtual OvidVRControllerClass.ControllerTypes GetControllerType()

Gets the state of the controller

Returns

Returns true if the controller is enabled, false otherwise

public inline virtual void SetControllerType(OvidVRControllerClass.ControllerTypes _controllerTypes)

Sets the controller state

Parameters
  • _controllerTypes

public abstract float GetControllerGrabStrength(OvidVRControllerClass.OvidVRHand _hand)

Function to get the controllers grab strength value.

Returns -2.0f if no controller is specified

Parameters
  • hand Can be either “left” or “right”

Returns
public abstract string GetHandTag(GameObject child)

Get a string representation of the hand tag

Parameters
  • child The child gameobject, usually the colliding object

Returns

Returns the Tag of the current controllers hand gameobject

Returns null if no controller is specified

public abstract Transform GetHandTransform(GameObject child)

Returns the Transform of the current controllers hand gameobject

Parameters
  • child The child collider of the hand

Returns

Returns the transform of the current hand gameobject

Returns null if no controller is specified

public abstract void ControllerHapticPulse(OvidVRControllerClass.OvidVRHand _hand,float strength,float _freq,float _duration)

Creates a haptic pulse on vive controller

Parameters
  • hand Left OR right controller

  • strength The pulse strength : [Range 0 -> 1]

public abstract bool GetIsGrabed(OvidVRControllerClass.OvidVRHand _hand)

Get the state if the grip button is pressed

Parameters
  • hand Hand to look if pressed

Returns

Returns true if the grip button is pressed

public abstract void SetBothControllersConnection(bool _bothContrConnected)
public abstract Vector2 GetThumpPosOnController(OvidVRControllerClass.OvidVRHand _hand)

Returns the position of the thump

Parameters
  • hand The hand that grabs an object in the scene

Returns

Returns an cartesian representation of the thump on the controller

public abstract OvidVRControllerClass.OvidVRControllerButtons GetPressedButtons()

Sees which buttons are pressed

Returns

Returns a list of the presseed buttons

class ovidVR::GameController::OvidVRControllerClass

class ovidVR::GameController::OvidVRControllerClass
  : public MonoBehaviour

This class is the link between the device manager and network manager The Device manager needs to be overriden for each controller type

Summary

{property} bool IsInNetwork

{property} ControllerDOF DOF Controller’s degrees of freedom, if DeviceController is null will find the first available DeviceController

{property} OvidVRControllerClass Get Singleton Instance of ovidVRControllerClass. public ControllerTypes controllerType

public bool isServer

public bool isClient

public GameObject rightController

public GameObject rightHand

public inline virtual GameObject AttachToolRight()

public inline virtual GameObject AttachToolLeft()

public inline virtual GameObject AttachTool(OvidVRHand _hand)

public inline virtual ControllerTypes GetControllerType() User accessible function to get the current controller type

public inline virtual void SetControllerType(ControllerTypes _controllerTypes)

public inline void SetIsGrabed(bool value)

public inline float GetControllerGrabStrength(OvidVRHand _hand) Function to get the controllers grab strength value.

public inline string GetHandTag(GameObject child) Returns the Tag of the current controllers hand gameobject

public inline void ControllerHapticPulse(OvidVRHand _hand,float strength) Creates a haptic pulse on the controller

public inline bool GetIsGrabed(OvidVRHand _hand) Returns true if the grip button is pressed

public inline void SetBothControllersConnection(bool _bothContrConnected)

public inline bool GetTriggerPressed(OvidVRHand _hand) Get the status of trigger button

public inline OvidVRControllerButtons GetPressedButtons() Sees which buttons are pressed

public inline bool GetIsSpectator()

protected inline  OvidVRControllerClass() ovidVRControllerClass protected constructor

enum ControllerTypes

enum OvidVRHand

enum OvidVRControllerButtons

Members

{property} bool IsInNetwork
{property} ControllerDOF DOF

Controller’s degrees of freedom, if DeviceController is null will find the first available DeviceController

{property} OvidVRControllerClass Get

Singleton Instance of ovidVRControllerClass.


Returns

Returns the main controller.

public bool isServer
public bool isClient
public GameObject rightController
public GameObject rightHand
public inline virtual GameObject AttachToolRight()
public inline virtual GameObject AttachToolLeft()
public inline virtual GameObject AttachTool(OvidVRHand _hand)
public inline virtual ControllerTypes GetControllerType()

User accessible function to get the current controller type

Returns

Returns the type of current controller (HTC-Vice/Oculus Rift)

public inline virtual void SetControllerType(ControllerTypes _controllerTypes)
public inline void SetIsGrabed(bool value)
public inline float GetControllerGrabStrength(OvidVRHand _hand)

Function to get the controllers grab strength value.

Returns -2.0f if no controller is specified

Parameters
  • hand Can be either left or right

Returns
public inline string GetHandTag(GameObject child)

Returns the Tag of the current controllers hand gameobject

Returns null if no controller is specified

Parameters
  • child The child gameobject, usually the colliding object

Returns
public inline void ControllerHapticPulse(OvidVRHand _hand,float strength)

Creats a haptic pulse on the controller

Parameters
  • hand Left or right controller

  • strength The pulse strength : [Range 0 -> 1]

public inline bool GetIsGrabed(OvidVRHand _hand)

Returns true if the grip button is pressed

Parameters
  • hand Hand to look if pressed

Returns
public inline void SetBothControllersConnection(bool _bothContrConnected)
public inline bool GetTriggerPressed(OvidVRHand _hand)

Get the status of trigger button

Parameters
  • _hand In which hand

Returns

Returns if trigger is pressed

public inline OvidVRControllerButtons GetPressedButtons()

Sees which buttons are pressed

Returns

Returns a list of the presseed buttons

public inline bool GetIsSpectator()
protected inline  OvidVRControllerClass()

ovidVRControllerClass protected constructor

Initializes the Singleton Instance!!!

enum ControllerTypes

HTCViveController
OculusTouchController
WindowsMixedRealityController
NoController

enum OvidVRHand

left
right

enum OvidVRControllerButtons

TriggerButton
GripButton
MenuButton
A
B
X
Y
ThumbStick

namespace ovidVR::GameController::Network

Summary

class ovidVR::GameController::Network::OvidVRNetworkmanager Base class for network managment Some functions need to be overriden to add application specific functionalities

class ovidVR::GameController::Network::OvidVRNetworkmanager

Base class for network managment Some functions need to be overriden to add application specific functionalities

Summary

public Transform spawnPosition

public int curPlayer

public inline virtual void OnStartServer() Called when starting a network session as server

public inline virtual void OnStartClient() Called when starting a network session as client

public inline bool GetIsInNetwork()

public inline bool GetIsServer() Gets the status of the current application instance

public inline bool GetIsClient() Gets the status of the current application instance

public inline void SetIsServer(bool value) Sets the status of the current application instance

public inline void SetIsClient(bool value) Sets the status of the current application instance

public inline bool GetIsSpectator()

public inline void SetIsSpectator(bool _isSpectator)

Members

public Transform spawnPosition
public int curPlayer
public inline virtual void OnStartServer()

Called when starting a network session as server

public inline virtual void OnStartClient()

Called when starting a network session as client

Parameters
  • client

public inline bool GetIsInNetwork()
Returns

True if the local machine is in a network session.

public inline bool GetIsServer()

Gets the status of the current application instance

Returns

Returns true if the application is the server

public inline bool GetIsClient()

Gets the status of the current application instance

Returns

Returns true if the application is client

public inline void SetIsServer(bool value)

Sets the status of the current application instance

public inline void SetIsClient(bool value)

Sets the status of the current application instance

public inline bool GetIsSpectator()
public inline void SetIsSpectator(bool _isSpectator)