/// <summary> /// Draws the vertex gizmo centered at the vertex position. /// </summary> /// <param name="position">The position of the vertex.</param> /// <param name="vertIndex">Index of the vertex.</param> /// <returns></returns> private VertGizmo drawVertGizmo(Vector3 position, int vertIndex) { GameObject vertGizmoGO = Instantiate(Resources.Load("prefabs/VertGizmo"), position, Quaternion.identity) as GameObject; VertGizmo vertGizmo = vertGizmoGO.transform.GetComponent <VertGizmo>(); vertGizmo.name = "vertGizmo" + vertIndex; vertGizmo.AddVertIndex(vertIndex); vertGizmo.EditableMesh = this; vertGizmoGO.transform.SetParent(_vertGizmosGroup); return(vertGizmo); }
private void Update() { if (!GameStates.DrawMode) { return; } LeapPinchSelector _pinchDetector = (_pinchDetectorA.DidStartPinch) ? _pinchDetectorA : (_pinchDetectorB.DidStartPinch) ? _pinchDetectorB : null; //bool pinchStart = _pinchDetectorA.DidStartPinch; if (_pinchDetector) { if (!_pinchDetector.LastPinchable) { VertGizmo vg = drawVertGizmo(_pinchDetector.Position, _verts.Count + _numVertsCur); _curQuad[_numVertsCur] = _pinchDetector.Position; _curVGS[_numVertsCur] = vg; _numVertsCur++; } else if (_pinchDetector.LastPinchable.GetType() == typeof(VertGizmo)) { VertGizmo vg = _pinchDetector.LastPinchable as VertGizmo; vg.IsReady = false; vg.AddVertIndex(_verts.Count + _numVertsCur); _curQuad[_numVertsCur] = vg.transform.position; _curVGS[_numVertsCur] = vg; _numVertsCur++; } } if (_numVertsCur == 4) { finalizeQuad(); _numVertsCur = 0; } }