void DeformMesh() { ray = cam.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out Hit)) { //Deform Mesh DeformPlane deformPlane = Hit.transform.GetComponent <DeformPlane>(); deformPlane.DeformThisPlane(Hit.point); Instantiate(ringPrefab, new Vector3(Hit.point.x, Hit.point.y, Hit.point.z + 0.62f), Quaternion.Euler(-90, 0, 0)); } }
void DeformMesh() { if ((lastPos = Input.mousePosition).sqrMagnitude > 2) { ray = cam.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { DeformPlane deformthePlane = hit.transform.GetComponent <DeformPlane>(); deformthePlane.DeformThisPlane(hit.point); Instantiate(ringPrefab, new Vector3(hit.point.x, hit.point.y, hit.point.z - 0.2f), Quaternion.Euler(-90, 0, 0)); } lastPos = Input.mousePosition; } }