//初始化示意框 void InitGizmo() { rectGizmo = Resources.Load("rectGizmo") as GameObject; rectGizmo = Instantiate(rectGizmo, cs_setup.bounds.center + (-cs_setup.bounds.extents.y + (slider ? slider.value : 0) + zeroAlignmentVector.y) * transform.up, Quaternion.identity) as GameObject; RectGizmo rg = rectGizmo.GetComponent <RectGizmo>(); rg.SetSizedGizmo(cs_setup.bounds.size, selectedAxis); }
public static void DrawRect(string name, Vector3 worldPos, Vector3 worldSize, Color color = new Color(), bool additive = false) { RectGizmo gizmo = new RectGizmo() { pos = new Vector2D(worldPos.x, worldPos.z), size = new Vector2D(worldSize.x, worldSize.z) }; AddGizmo(name, gizmo, color, clearOthers: !additive); }
public void SetAxis(bool b, ConstrainedAxis a) { if (b) { selectedAxis = a; Debug.Log(a); RectGizmo rg = rectGizmo.GetComponent <RectGizmo>(); rg.transform.position = Vector3.zero; rg.SetSizedGizmo(cs_setup.bounds.size, selectedAxis); setSection(); } }
void setupGizmo() { rectGizmo = Resources.Load("rectGizmo") as GameObject; if (rectGizmo) { Debug.Log("rectGizmo"); } if (cs_setup) { Debug.Log("cs_setup"); } rectGizmo = Instantiate(rectGizmo, cs_setup.bounds.center + (-cs_setup.bounds.extents.y + (slider ? slider.value : 0) + zeroAlignmentVector.y) * transform.up, Quaternion.identity) as GameObject; RectGizmo rg = rectGizmo.GetComponent <RectGizmo>(); rg.SetSizedGizmo(cs_setup.bounds.size, selectedAxis); /* Set rectangular gizmo size here: inner width, inner height, border width. */ rectGizmo.SetActive(false); }