void Update() { SimpleWebXR.UpdateWebXR(); UpdateHand(_left, SimpleWebXR.LeftInput.Hand); UpdateHand(_right, SimpleWebXR.RightInput.Hand); }
public override void Enable() { base.Enable(); // create SimpleWebXR component to display "Start AR" or "Start VR" button and call SimpleWebXR.UpdateWebXR() at each frame SimpleWebXR.EnsureInstance(); }
public override void Enable() { base.Enable(); xr = SimpleWebXR.EnsureInstance(); xr.SessionStart.AddListener(OnSessionStart); xr.SessionEnd.AddListener(OnSessionEnd); }
void Start() { _xr = SimpleWebXR.EnsureInstance(); _style = new GUIStyle(); _style.richText = true; _style.alignment = TextAnchor.UpperLeft; }
public override void Disable() { base.Disable(); SimpleWebXR.EndSession(); RemoveAllControllerDevices(); RemoveAllHandDevices(); }
public override void Enable() { base.Enable(); // create SimpleWebXR component to display "Start AR" or "Start VR" button and call SimpleWebXR.UpdateWebXR() at each frame SimpleWebXR.EnsureInstance(); SimpleWebXR.SessionStart.AddListener(OnSessionStart); SimpleWebXR.SessionEnd.AddListener(OnSessionEnd); }
public override void Disable() { base.Disable(); SimpleWebXR.EndSession(); SimpleWebXR.SessionStart.RemoveListener(OnSessionStart); SimpleWebXR.SessionEnd.RemoveListener(OnSessionEnd); RemoveAllControllerDevices(); RemoveAllHandDevices(); }
void Start() { _xr = SimpleWebXR.EnsureInstance(); if (!_xr) { return; } // Create spheres _left = CreateHand("Left"); _right = CreateHand("Right"); }
private async void Start() { _xr = SimpleWebXR.GetInstance(); Host = PlayerPrefs.GetString("ip", "localhost"); _lowQuality = PlayerPrefs.GetInt("Low quality", 1) != 0; StartCoroutine(PollImage()); await InitWebSocket(); }
void Start() { _xr = SimpleWebXR.GetInstance(); if (!_xr) { return; } _input = IsLeft ? _xr.LeftInput : _xr.RightInput; _input.SelectStart.AddListener(() => StartCoroutine(DrawCoroutine())); _input.SelectEnd.AddListener(StopAllCoroutines); _renderer = GetComponent <MeshRenderer>(); }
void Start() { _session = SimpleWebXR.GetInstance(); if (!_session) { return; } _session.LeftInput.SelectStart.AddListener(() => SelectLeft.text = "LEFT"); _session.LeftInput.SelectEnd.AddListener(() => SelectLeft.text = "---"); _session.LeftInput.SqueezeStart.AddListener(() => SqueezeLeft.text = "LEFT"); _session.LeftInput.SqueezeEnd.AddListener(() => SqueezeLeft.text = "---"); _session.RightInput.SelectStart.AddListener(() => SelectRight.text = "RIGHT"); _session.RightInput.SelectEnd.AddListener(() => SelectRight.text = "---"); _session.RightInput.SqueezeStart.AddListener(() => SqueezeRight.text = "RIGHT"); _session.RightInput.SqueezeEnd.AddListener(() => SqueezeRight.text = "---"); }
void Start() { _session = SimpleWebXR.GetInstance(); }
public void Pulse(float duration) { SimpleWebXR.HapticPulse(SimpleWebXR.LeftInput.Selected ? WebXRHandedness.Left : WebXRHandedness.Right, 1, duration); }
private void Update() { var dataArray = SimpleWebXR.SimulatedDataArray; var byteArray = SimpleWebXR.SimulatedByteArray; // [0] : number of views (0 : session is stopped) byteArray[0] = (byte)(_sessionStarted ? (SimulationRender2Eyes ? 3 : 1) : 0); if (_sessionStarted) { // [0] -> [15] : projection matrix of view 1 var pm = Camera.main.projectionMatrix; dataArray[0] = pm.m00; dataArray[4] = pm.m01; dataArray[8] = pm.m02; dataArray[12] = pm.m03; dataArray[1] = pm.m10; dataArray[5] = pm.m11; dataArray[9] = pm.m12; dataArray[13] = pm.m13; dataArray[2] = pm.m20; dataArray[6] = pm.m21; dataArray[10] = pm.m22; dataArray[14] = pm.m23; dataArray[3] = pm.m30; dataArray[7] = pm.m31; dataArray[11] = pm.m32; dataArray[15] = pm.m33; // [16], [17], [18] : X, Y, Z position in m of view 1 dataArray[16] = _simulateHead.transform.position.x; dataArray[17] = _simulateHead.transform.position.y; dataArray[18] = -_simulateHead.transform.position.z; // [19], [20], [21], [22] : RX, RY, RZ, RW rotation (quaternion) of view 1 var rotation = SimpleWebXR.SimulatedToUnityRotation(_simulateHead.transform.rotation); dataArray[19] = rotation.x; dataArray[20] = rotation.y; dataArray[21] = rotation.z; dataArray[22] = rotation.w; // [23] -> [26] : Viewport X, Y, width, height of view 1 dataArray[23] = 0; dataArray[24] = 0; dataArray[25] = 1; dataArray[26] = 1; if (SimulationRender2Eyes) { dataArray[25] = 0.5f; // [27] -> [42] : projection matrix of view 2 // [43], [44], [45] : X, Y, Z position in m of view 2 // [46], [47], [48], [49] : RX, RY, RZ, RW rotation (quaternion) of view 2 for (int i = 0; i <= 26; i++) { dataArray[27 + i] = dataArray[i]; } // [50] -> [53] : Viewport X, Y, width, height of view 2 dataArray[50] = 0.5f; } // [54] -> [60] : Left input x, y, z, rx, ry, rz, rw rotation = SimpleWebXR.SimulatedToUnityRotation(_simulateLeft.transform.rotation); dataArray[54] = _simulateLeft.transform.position.x; dataArray[55] = _simulateLeft.transform.position.y; dataArray[56] = -_simulateLeft.transform.position.z; dataArray[57] = rotation.x; dataArray[58] = rotation.y; dataArray[59] = rotation.z; dataArray[60] = rotation.w; // [77] -> [83] : right input x, y, z, rx, ry, rz, rw rotation = SimpleWebXR.SimulatedToUnityRotation(_simulateRight.transform.rotation); dataArray[77] = _simulateRight.transform.position.x; dataArray[78] = _simulateRight.transform.position.y; dataArray[79] = -_simulateRight.transform.position.z; dataArray[80] = rotation.x; dataArray[81] = rotation.y; dataArray[82] = rotation.z; dataArray[83] = rotation.w; // [100] : user height dataArray[100] = SimulationUserHeight; // [4] : left input has position info byteArray[4] = 1; // [24] : right input has position info byteArray[24] = 1; // [44] : Left controller active byteArray[44] = 1; // [45] : Right controller active byteArray[45] = 1; // [1] : left controller events if (SimulationLeftSelect && !SimpleWebXR.LeftInput.Selected) { byteArray[1] = 8; } else if (!SimulationLeftSelect && SimpleWebXR.LeftInput.Selected) { byteArray[1] = 32; } else { byteArray[1] = 0; } // [2] : right controller events if (SimulationRightSelect && !SimpleWebXR.RightInput.Selected) { byteArray[2] = 8; } else if (!SimulationRightSelect && SimpleWebXR.RightInput.Selected) { byteArray[2] = 32; } else { byteArray[2] = 0; } // [5] : left input target ray mode byteArray[5] = (byte)SimulationMode; // [25] : right input target ray mode byteArray[25] = byteArray[5]; } }
void Start() { _session = SimpleWebXR.GetInstance(); _text = GetComponentInChildren <Text>(); }