private void DrawBounds() { ColorGradient cg = new ColorGradient(Color.red, Color.blue); foreach (OctreeNode node in nodes) { if (node.GetPoints(pointFilter, points)) { // Assuming node size range between 0.25 and 64 float t = Mathf.Log(node.Size * 4f, 2f) / 8f; float sqrDist = (center - node.Center).sqrMagnitude; float dim = Mathf.Max(0f, 1f - sqrDist / sqrRadius); Color col = cg.GetColor(t, dim); // Slight offset to prevent overlapping lines. Vector3 size = Vector3.one * (node.Size - t * 0.01f); Gizmos.Cube(node.Center, Quaternion.identity, size, col); } } }
private void DrawPoints() { Vector3 size = Vector3.one * 0.02f; Dictionary <PointType, Color> colors = new Dictionary <PointType, Color>() { { PointType.DronePos, Color.yellow }, { PointType.ScanPoint, Color.green }, { PointType.ScanOutOfRange, Color.red } }; foreach (OctreeNode node in nodes) { if (node.GetPoints(pointFilter, points)) { foreach (Point point in points) { Gizmos.Cube(point.Position, Quaternion.identity, size, colors[point.Type]); } } } }
public void Draw() { IOrderedEnumerable <Vector4> sorted = Chronological; Vector4 s = Vector4.zero; foreach (Vector4 p in sorted) { Gizmos.Line(s.Equals(Vector4.zero) ? p : s, p, Color.yellow); s = p; } Vector3 c = Center; // Bounding Box Gizmos.Cube(c, Quaternion.identity, bounds.size, Color.gray); // Crosshair float l = 0.25f; Gizmos.Line(c + Vector3.left * l, c + Vector3.right * l, Color.white); Gizmos.Line(c + Vector3.up * l, c + Vector3.down * l, Color.white); Gizmos.Line(c + Vector3.forward * l, c + Vector3.back * l, Color.white); }