private void RayCastPickMesh() { if (Input.GetMouseButton(0) && !dialog.isVisible) { RaycastHit raycastHit; LayerMask layerMask = LayerMask.GetMask(new string[] { "3D Model" }); Ray ray = sessionOrigin.camera.ScreenPointToRay(Input.mousePosition); bool collision = Physics.Raycast(ray, out raycastHit, 10, layerMask); if (collision) { dialog.Set(raycastHit.collider.name); } } }
private void RayCastPickMesh() { if (Input.GetMouseButton(0)) { RaycastHit raycastHit; LayerMask layerMask = LayerMask.GetMask(new string[] { "3D Model" }); Ray ray = sessionOrigin.camera.ScreenPointToRay(Input.mousePosition); bool collision = Physics.Raycast(ray, out raycastHit, 10, layerMask); if (collision) { canvasI.SetActive(true); dialog.Set("There are 421 ways of saying the word snow in Scotland!"); } } }