public override void OnVisualize(Visualizer visualizer) { MaxTracked = Math.Max(MaxTracked, Detected.Length); foreach (var detected in Detected) { Color color; switch (detected.Label) { case "Car": color = Color.green; break; case "Pedestrian": color = Color.yellow; break; case "Bicycle": color = Color.cyan; break; default: color = Color.magenta; break; } if (MapOrigin == null) { Debug.LogError("Fail to visualize Apollo perceptions due to null MapOrigin."); return; } var position = MapOrigin.NorthingEastingToPosition(detected.Gps.Northing, detected.Gps.Easting); position.y = (float)detected.Gps.Altitude - MapOrigin.AltitudeOffset; var mapRotation = MapOrigin.transform.localRotation; var rotationY = detected.Heading + mapRotation.eulerAngles.y; Quaternion rotation = Quaternion.Euler(0, (float)rotationY, 0); var transform = Matrix4x4.TRS(position, rotation, Vector3.one); WireframeBoxes.Draw(transform, Vector3.zero, detected.Scale, color); } }