private void OnPostRender() { pos = transform.position + transform.forward * 10 + transform.up * 5 + transform.right * 7; shapesMaterial.SetPass(0); Graphics.DrawMeshNow(GLDraw.CreateArrow(Color.red, 1), pos, Quaternion.Euler(90, 0, 0)); GL.Begin(GL.LINES); GL.Color(Color.red); GL.Vertex(pos); GL.Vertex(pos - Vector3.forward * 1); GL.End(); }
/// <summary> /// 绘制坐标系箭头 /// </summary> private void DrawCoordinateArrow(Transform target) { Vector3 position = target.position; Vector3 euler = target.eulerAngles; // 画坐标轴的箭头 (箭头的锥顶不是它自身坐标的forword) Mesh meshX = GLDraw.CreateArrow(m_SelectedAxis == RuntimeHandleAxis.X ? m_SelectedColor : Color.red, m_ArrowScale * m_ScreenScale); Graphics.DrawMeshNow(meshX, position + target.right * m_HandleScale * m_ScreenScale, target.rotation * Quaternion.Euler(0, 0, -90)); Mesh meshY = GLDraw.CreateArrow(m_SelectedAxis == RuntimeHandleAxis.Y ? m_SelectedColor : Color.green, m_ArrowScale * m_ScreenScale); Graphics.DrawMeshNow(meshY, position + target.up * m_HandleScale * m_ScreenScale, target.rotation); Mesh meshZ = GLDraw.CreateArrow(m_SelectedAxis == RuntimeHandleAxis.Z ? m_SelectedColor : Color.blue, m_ArrowScale * m_ScreenScale); Graphics.DrawMeshNow(meshZ, position + target.forward * m_HandleScale * m_ScreenScale, target.rotation * Quaternion.Euler(90, 0, 0)); }