private void Update() { if (Model != null) { Model.ModelScale = Appearance.HandleScale; Model.SelectionMargin = Appearance.SelectionMargin; } if (m_isDragging) { if (Editor.Tools.IsViewing) { m_isDragging = false; } else { if (m_unitSnapping) { EffectiveGridUnitSize = CurrentGridUnitSize; } else { EffectiveGridUnitSize = 0; } OnDrag(); } } else { if (!Window.IsPointerOver) { SelectedAxis = RuntimeHandleAxis.None; } } UpdateOverride(); if (m_isDragging) { if (Editor.Tools.PivotMode == RuntimePivotMode.Center && m_commonCenterTarget != null && m_realTargets != null && m_realTargets.Length > 1) { for (int i = 0; i < m_commonCenterTarget.Length; ++i) { Transform commonCenterTarget = m_commonCenterTarget[i]; Transform target = m_realTargets[i]; target.transform.position = commonCenterTarget.position; target.transform.rotation = commonCenterTarget.rotation; target.transform.localScale = commonCenterTarget.lossyScale; //Debug.Log(commonCenterTarget.localScale); } } if (m_commonCenter != null && m_commonCenter.Length > 0) { for (int i = 0; i < m_allHandles.Count; ++i) { BaseHandle handle = m_allHandles[i]; if (handle.Editor == Editor && handle.gameObject.activeSelf) { handle.m_commonCenter[0].position = m_commonCenter[0].position; handle.m_commonCenter[0].rotation = m_commonCenter[0].rotation; handle.m_commonCenter[0].localScale = m_commonCenter[0].localScale; } } } } }
public virtual void Add(BaseHandle handle) { m_handles.Add(handle); }
public virtual void Remove(BaseHandle handle) { m_handles.Remove(handle); }
/// <summary> /// 当物体碰到墙面时,触发左键抬起事件,解除控制 /// </summary> public void Delete() { OnDrop(); m_isDragging = false; m_draggingTool = null; }