Tanoda
VRInput.cs
Go to the documentation of this file.
1using System.Collections;
2using System.Collections.Generic;
3using UnityEngine;
6#if !UNITY_WEBGL
7using Valve.VR;
8#endif
9
10public class VRInput : BaseInput
11{
12#if !UNITY_WEBGL
13 public Camera eventCamera = null;
14 public SteamVR_Action_Boolean clickButton = SteamVR_Input.GetAction<SteamVR_Action_Boolean>("InteractUI");
15
16 protected override void Awake()
17 {
18 GetComponent<BaseInputModule>().inputOverride = this;
19 }
20
21 public override bool GetMouseButton(int button)
22 {
23 return clickButton.state;
24 }
25
26 public override bool GetMouseButtonDown(int button)
27 {
28 return clickButton.stateDown;
29 }
30
31 public override bool GetMouseButtonUp(int button)
32 {
33 return clickButton.stateUp;
34 }
35
36 public override Vector2 mousePosition
37 {
38 get
39 {
40 return new Vector2(eventCamera.pixelWidth / 2, eventCamera.pixelHeight / 2);
41 }
42 }
43#endif
44}
override void Awake()
Definition: VRInput.cs:16
override bool GetMouseButtonDown(int button)
Definition: VRInput.cs:26
SteamVR_Action_Boolean clickButton
Definition: VRInput.cs:14
override Vector2 mousePosition
Definition: VRInput.cs:37
override bool GetMouseButtonUp(int button)
Definition: VRInput.cs:31
override bool GetMouseButton(int button)
Definition: VRInput.cs:21
Camera eventCamera
Definition: VRInput.cs:13