void Update() { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); Debug.DrawRay(ray.origin, ray.direction * 500, Color.cyan); RaycastHit hit = new RaycastHit(); if (Physics.Raycast(ray, out hit, 500)) { //Debug.Log(hit.transform.position.x + ", " + hit.transform.position.y + ", " + hit.transform.position.z); SliceMesh sliceMesh = hit.transform.GetComponent <SliceMesh>(); //Debug.Log("Constituent in 0,0 , 0 : " + slice.Voxels[0, 0].Constituents[0].Name); if (sliceMesh != null) { Slice slice = sliceMesh.Slice; if (Input.GetMouseButtonUp(0) && !EventSystem.current.IsPointerOverGameObject()) { Debug.Log("Slice clicked: " + slice.X + ", " + slice.Y + ", " + slice.Z); if (slice.IsMeshVisible()) { slice.SetHidden(); } } } } }
void Update() { if (Input.GetMouseButtonDown(0)) { downPos = Utility.MousePostionToWorld(Input.mousePosition, meshObject.transform); drawing = true; ActiveOthers(true); } if (Input.GetMouseButtonUp(0)) { drawing = false; ActiveOthers(false); Mesh[] meshes = SliceMesh.DoSlice(new Panel(panel.up, panel.position), meshObject); OnSliced(meshes); } if (drawing) { upPos = Utility.MousePostionToWorld(Input.mousePosition, meshObject.transform); lineRenderer.startWidth = 0.05f; lineRenderer.endWidth = 0.05f; lineRenderer.SetPositions(new Vector3[] { downPos, upPos }); DrawPanel(); } }
public int AddMesh(DMesh3 mesh, PrintMeshOptions options) { SliceMesh m = new SliceMesh() { mesh = mesh, bounds = mesh.CachedBounds, options = options }; int idx = Meshes.Count; Meshes.Add(m); return(idx); }
// Use this for initialization void Start() { UnityEngine.Debug.Log("Start init RayMarching"); RayMarching ray = GameObject.Find("Camera0").GetComponent <RayMarching>(); ray.setShaders(compositeShader, renderFrontDepthShader, renderBackDepthShader, rayMarchShader); ray.setTarget(); SliceMesh s = GameObject.Find("Camera0").GetComponent <SliceMesh> (); s.setSize(mesh); UnityEngine.Debug.Log("End init RayMarching"); }