public void Draw(Color color) { float max = Distances.Max(); float[] distances = new float[Distances.Length]; for (int i = 0; i < distances.Length; i++) { distances[i] = Distances[i].Normalize(0f, max, 1f, 0f); } Vector3 position = Pivot.GetPosition(); Quaternion rotation = Pivot.GetRotation(); UltiDraw.Begin(); Vector3 step = GetStep(); if (Size != Vector3.zero) { UltiDraw.DrawWireCuboid(position, rotation, Size, color); for (int i = 0; i < Points.Length; i++) { if (distances[i] > 0f) { UltiDraw.DrawCuboid(References[i], rotation, step, Color.Lerp(UltiDraw.None, color, distances[i])); } } } UltiDraw.End(); }
public void DrawReferences() { Vector3 position = Pivot.GetPosition(); Quaternion rotation = Pivot.GetRotation(); UltiDraw.Begin(); Vector3 step = GetStep(); if (step != Vector3.zero) { Color reference = UltiDraw.Black.Opacity(0.05f); for (int i = 0; i < Points.Length; i++) { UltiDraw.DrawCuboid(References[i], rotation, step, reference); } } UltiDraw.End(); }
void OnRenderObject() { UltiDraw.Begin(); if (ShowGeometry) { foreach (BoxCollider c in GetColliders()) { UltiDraw.DrawCuboid(c.transform.position + c.transform.rotation * Vector3.Scale(c.center, c.transform.lossyScale), c.transform.rotation, Vector3.Scale(c.size, c.transform.lossyScale), UltiDraw.Green.Opacity(0.5f)); } } if (ShowBounds) { UltiDraw.DrawWireCuboid(GetCenter(), transform.rotation, GetExtents(), UltiDraw.Black); } UltiDraw.End(); }
public void DrawReferences() { Vector3 position = Pivot.GetPosition(); Quaternion rotation = Pivot.GetRotation(); UltiDraw.Begin(); Vector3 step = GetStep(); Color reference = UltiDraw.Black.Opacity(0.05f); UltiDraw.DrawTranslateGizmo(position, rotation, 0.25f); for (int i = 0; i < Points.Length; i++) { UltiDraw.DrawCuboid(References[i], rotation, step == Vector3.zero ? 0.25f * Vector3.one : step, reference); UltiDraw.DrawSphere(References[i], rotation, 0.0125f, UltiDraw.Black.Opacity(0.25f)); UltiDraw.DrawLine(References[i], Closest[i].GetRelativePositionFrom(Pivot), UltiDraw.White.Opacity(0.5f)); UltiDraw.DrawSphere(Closest[i].GetRelativePositionFrom(Pivot), rotation, 0.0125f, UltiDraw.White); } UltiDraw.End(); }
void OnRenderObject() { UltiDraw.Begin(); if (ShowGeometry) { foreach (BoxCollider c in GetVoxels()) { UltiDraw.DrawCuboid(c.transform.position + c.transform.rotation * Vector3.Scale(c.center, c.transform.lossyScale), c.transform.rotation, Vector3.Scale(c.size, c.transform.lossyScale), UltiDraw.Green.Transparent(0.5f)); } } if (ShowBounds) { UltiDraw.DrawWireCuboid(GetCenter().GetRelativePositionFrom(transform.GetWorldMatrix()), transform.rotation, Vector3.Scale(GetExtents(), transform.lossyScale), UltiDraw.Black); } UltiDraw.End(); }
public void Draw(Color color) { Vector3 position = Pivot.GetPosition(); Quaternion rotation = Pivot.GetRotation(); UltiDraw.Begin(); Vector3 step = GetStep(); if (Size != Vector3.zero) { UltiDraw.DrawWireCuboid(position, rotation, Size, color); for (int i = 0; i < Points.Length; i++) { if (Occupancies[i] > 0f) { UltiDraw.DrawCuboid(References[i], rotation, step, Color.Lerp(UltiDraw.None, color, Occupancies[i])); } } } UltiDraw.End(); }
void OnRenderObject() { UltiDraw.Begin(); if (Selected != null && Collider != null) { if (Collider is BoxCollider) { BoxCollider c = (BoxCollider)Collider; if (Input.GetKey(Translate)) { UltiDraw.DrawCuboid(c.bounds.center, c.transform.rotation, Vector3.Scale(c.transform.lossyScale, c.size), UltiDraw.Black.Opacity(0.25f)); UltiDraw.DrawWireCuboid(c.bounds.center, c.transform.rotation, Vector3.Scale(c.transform.lossyScale, c.size), UltiDraw.Purple); UltiDraw.DrawTranslateGizmo(c.bounds.center, c.transform.rotation, c.size.magnitude); } if (Input.GetKey(Rotate)) { UltiDraw.DrawCuboid(c.bounds.center, c.transform.rotation, Vector3.Scale(c.transform.lossyScale, c.size), UltiDraw.Black.Opacity(0.25f)); UltiDraw.DrawWireCuboid(c.bounds.center, c.transform.rotation, Vector3.Scale(c.transform.lossyScale, c.size), UltiDraw.Purple); UltiDraw.DrawRotateGizmo(c.bounds.center, c.transform.rotation, c.size.magnitude); } } } else { Collider collider = Utility.GetSelectedCollider(); if (collider.gameObject == gameObject) { if (collider is BoxCollider) { BoxCollider c = (BoxCollider)collider; UltiDraw.DrawWireCuboid(c.bounds.center, c.transform.rotation, Vector3.Scale(c.transform.lossyScale, c.size), UltiDraw.Black.Opacity(0.5f)); } } } UltiDraw.End(); }
void Draw() { float speed = 100f; float spacing = 1.5f; float height = 1f; int index = 0; Color[] colors = UltiDraw.GetRainbowColors(9); UltiDraw.Begin(); UltiDraw.SetDepthRendering(DepthRendering); UltiDraw.SetCurvature(0f); UltiDraw.DrawQuad(Vector3.zero, Quaternion.Euler(90f, 0f, 0f), 100f, 100f, UltiDraw.DarkGrey); UltiDraw.SetCurvature(0.25f); UltiDraw.DrawGrid(Vector3.zero, Quaternion.identity, 100, 100, 1f, 1f, UltiDraw.DarkGreen.Transparent(0.5f)); UltiDraw.DrawWireCube(new Vector3(index * spacing, height, 0f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 1f, colors[index]); UltiDraw.DrawCube(new Vector3(index * spacing, height, 1f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 1f, colors[index]); UltiDraw.DrawWiredCube(new Vector3(index * spacing, height, 2f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 1f, colors[index], UltiDraw.White); index += 1; UltiDraw.DrawWireSphere(new Vector3(index * spacing, height, 0f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 1f, colors[index]); UltiDraw.DrawSphere(new Vector3(index * spacing, height, 1f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 1f, colors[index]); UltiDraw.DrawWiredSphere(new Vector3(index * spacing, height, 2f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 1f, colors[index], UltiDraw.White); index += 1; UltiDraw.DrawWireCapsule(new Vector3(index * spacing, height, 0f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.5f, 1f, colors[index]); UltiDraw.DrawCapsule(new Vector3(index * spacing, height, 1f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.5f, 1f, colors[index]); UltiDraw.DrawWiredCapsule(new Vector3(index * spacing, height, 2f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.5f, 1f, colors[index], UltiDraw.White); index += 1; UltiDraw.DrawWireBone(new Vector3(index * spacing, height - 0.5f, 0f * spacing), Quaternion.Euler(-90f, speed * Time.time, 0f), 1f, 1f, colors[index]); UltiDraw.DrawBone(new Vector3(index * spacing, height - 0.5f, 1f * spacing), Quaternion.Euler(-90f, speed * Time.time, 0f), 1f, 1f, colors[index]); UltiDraw.DrawWiredBone(new Vector3(index * spacing, height - 0.5f, 2f * spacing), Quaternion.Euler(-90f, speed * Time.time, 0f), 1f, 1f, colors[index], UltiDraw.White); index += 1; UltiDraw.DrawWireCylinder(new Vector3(index * spacing, height, 0f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.5f, 1f, colors[index]); UltiDraw.DrawCylinder(new Vector3(index * spacing, height, 1f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.5f, 1f, colors[index]); UltiDraw.DrawWiredCylinder(new Vector3(index * spacing, height, 2f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.5f, 1f, colors[index], UltiDraw.White); index += 1; UltiDraw.DrawWirePyramid(new Vector3(index * spacing, height - 0.5f, 0f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 1f, 1f, colors[index]); UltiDraw.DrawPyramid(new Vector3(index * spacing, height - 0.5f, 1f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 1f, 1f, colors[index]); UltiDraw.DrawWiredPyramid(new Vector3(index * spacing, height - 0.5f, 2f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 1f, 1f, colors[index], UltiDraw.White); index += 1; UltiDraw.DrawWireCone(new Vector3(index * spacing, height - 0.5f, 0f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.75f, 1f, colors[index]); UltiDraw.DrawCone(new Vector3(index * spacing, height - 0.5f, 1f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.75f, 1f, colors[index]); UltiDraw.DrawWiredCone(new Vector3(index * spacing, height - 0.5f, 2f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.75f, 1f, colors[index], UltiDraw.White); index += 1; UltiDraw.DrawWireCuboid(new Vector3(index * spacing, height, 0f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), new Vector3(0.5f, 1f, 0.5f), colors[index]); UltiDraw.DrawCuboid(new Vector3(index * spacing, height, 1f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), new Vector3(0.5f, 1f, 0.5f), colors[index]); UltiDraw.DrawWiredCuboid(new Vector3(index * spacing, height, 2f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), new Vector3(0.5f, 1f, 0.5f), colors[index], UltiDraw.White); index += 1; UltiDraw.DrawWireEllipsoid(new Vector3(index * spacing, height, 0f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.5f, 1f, colors[index]); UltiDraw.DrawEllipsoid(new Vector3(index * spacing, height, 1f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.5f, 1f, colors[index]); UltiDraw.DrawWiredEllipsoid(new Vector3(index * spacing, height, 2f * spacing), Quaternion.Euler(0f, speed * Time.time, 0f), 0.5f, 1f, colors[index], UltiDraw.White); index += 1; UltiDraw.End(); }