In my “quest” to learn more about RVOObstacle, I’ve implemented Gizmos to the RVONavmesh script. I don’t know if I’ve done something wrong, but there are strange effects on some lines (see picture below).
`
/** Draws Gizmos */
public void OnDrawGizmos()
{
OnDrawGizmos(false);
}
/** Draws Gizmos */
public void OnDrawGizmosSelected()
{
OnDrawGizmos(true);
}
/** Draws Gizmos */
public void OnDrawGizmos(bool selected)
{
Gizmos.color = new Color(0.615f, 1, 0.06f, selected ? 1.0f : 0.7f);
foreach (ObstacleVertex ov in obstacles)
{
if (ov.next == null)
throw new System.InvalidOperationException("obstacles[...].next == null");
Gizmos.DrawLine(ov.position, ov.next.position);
if (selected)
{
// Draw the little arrow to show the direction of the obstacle
Vector3 a = ov.position;
Vector3 b = ov.next.position;
Vector3 avg = (a + b) * 0.5f;
Vector3 tang = (b - a).normalized;
if (tang != Vector3.zero)
{
Vector3 normal = Vector3.Cross(Vector3.up, tang);
Gizmos.DrawLine(avg, avg + normal);
Gizmos.DrawLine(avg + normal, avg + normal * 0.5f + tang * 0.5f);
Gizmos.DrawLine(avg + normal, avg + normal * 0.5f - tang * 0.5f);
}
}
}
}
`