How Do I Know If a Controller Sends an Event¶
Introduction¶
In VIVE Wave™ SDK 3.0 or newer version, only one controller can send events when using 2 controllers simultaneously. The controller that can send events has a beam and pointer. A player in VR environment can change the controller that can send events by pulling the trigger on the controller.
In VIVE Wave™ SDK, a controller can be set as Dominant or Non-Dominant. Check the code below to know whether a controller sends events or not.
private GameObject eventSystem = null;
private void checkEventController()
{
// Get eventSystem instance.
if (EventSystem.current == null)
{
EventSystem _es = FindObjectOfType<EventSystem> ();
if (_es != null)
{
this.eventSystem = _es.gameObject;
}
} else
{
this.eventSystem = EventSystem.current.gameObject;
}
// Get WaveVR_ControllerInputModule to check event.
if (this.eventSystem != null)
{
WaveVR_ControllerInputModule _cim = this.eventSystem.GetComponent<WaveVR_ControllerInputModule> ();
if (_cim != null)
{
bool DominantControllerHasEvent = _cim.DomintEventEnabled;
bool NonDominantControllerHasEvent = _cim.NoDomtEventEnabled;
}
}
}