/// <summary> /// Get the mosue position, send a raycast and identify the vnc screen uder mouse cursor /// Then, if any, send mouse event to it /// </summary> void Update() { ray = new Ray(Camera.main.transform.position, Camera. main.transform.forward); if (Physics.Raycast(ray, out hit, 1000)) { Collider c = hit.collider; if (touchedCollider != c) { touchedCollider = c; vnc = c.GetComponent <VNCScreen.VNCScreen>(); } } else { touchedCollider = null; vnc = null; } if (vnc != null) { hit_pos = hit.point; transform.position = hit_pos; uvPos = hit.textureCoord2; //Debug.Log(uvPos); vnc.UpdateMouse(uvPos, false, false, false); } }
/// <summary> /// Get the mosue position, send a raycast and identify the vnc screen uder mouse cursor /// Then, if any, send mouse event to it /// </summary> void Update() { ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, 1000)) { Collider c = hit.collider; if (touchedCollider != c) { touchedCollider = c; vnc = c.GetComponent <VNCScreen>(); } } else { touchedCollider = null; vnc = null; } if (vnc != null) { hit_pos = hit.point; transform.position = hit_pos; uvPos = hit.textureCoord2; vnc.UpdateMouse(uvPos, Input.GetMouseButton(0), Input.GetMouseButton(2), Input.GetMouseButton(1)); showCursor(false); } else { showCursor(true); } }
private void createScreen(int display) { GameObject newScreen = Instantiate(screens, Camera.main.transform.position + Camera.main.transform.forward, Camera.main.transform.rotation); GameObject ChildGameObject1 = newScreen.transform.GetChild(0).gameObject; VNCScreen.VNCScreen yourObject = ChildGameObject1.GetComponent <VNCScreen.VNCScreen>(); yourObject.password = password.text; yourObject.port = 5900; yourObject.host = ipAdress.text; yourObject.display = display; var holoMenu = GameObject.Find("HoloMenu"); holoMenu.SetActive(false); }
void Start() { if (screen == null) { screen = GetComponent <VNCScreen>(); } if (screen == null) { screen = GetComponentInChildren <VNCScreen>(); } if (screen == null) { screen = GetComponentInParent <VNCScreen>(); } Debug.Assert(screen != null); screen.onStateChanged_event += onStateChanged; onStateChanged(screen.state); }