private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); return; } //Validate all the variable Transform components //Stoopid us proofing ValidateComponent(leftCtrl); ValidateComponent(rightCtrl); ValidateComponent(headset); ValidateComponent(playArea); //Get the VrControllerComponents from the relevant controllers left = leftCtrl.GetComponent <VrCtrl>(); right = rightCtrl.GetComponent <VrCtrl>(); //Initialise the two controllers left.Initialise(); right.Initialise(); }
public void Initialise(VrCtrl _controller) { controller = _controller; //Specify to link to a specific input source pointer.AddOnStateDownListener(OnPointerDown, controller.InputSource); pointer.AddOnStateUpListener(OnPointerUp, controller.InputSource); teleport.AddOnStateDownListener(OnTeleportDown, controller.InputSource); teleport.AddOnStateUpListener(OnTeleportUp, controller.InputSource); interact.AddOnStateDownListener(OnInteractDown, controller.InputSource); interact.AddOnStateUpListener(OnInteractUp, controller.InputSource); grab.AddOnStateDownListener(OnGrabDown, controller.InputSource); grab.AddOnStateUpListener(OnGrabUp, controller.InputSource); touchPadAxis.AddOnChangeListener(OnTouchPadChanged, controller.InputSource); }
/// <summary> /// Constructor to hold the controller, source and touch pad axis events. /// </summary> public InputEventArgs(VrCtrl _controller, SteamVR_Input_Sources _source, Vector2 _touchPadAxis) { controller = _controller; source = _source; touchPadAxis = _touchPadAxis; }