void OnDrawGizmosSelected()
    {
        if (Application.isPlaying)
        {
            DrawDebugJoint();
        }

        //Gizmos.DrawWireSphere(this.transform.position, sensorParameters.ViewDistance);

        DebugExtension.DebugCone(this.transform.position, this.transform.forward.normalized * sensorParameters.ViewDistance, Color.white, sensorParameters.ViewAngle / 2);
        foreach (Creature target in observedCreatures)
        {
            if (target == null)
            {
                return;
            }

            Vector3 dirToTarget = (target.transform.position - transform.position).normalized;
            float   dstToTarget = Vector3.Distance(transform.position, target.transform.position);
            DebugExtension.DebugArrow(this.transform.position, dirToTarget * dstToTarget, Color.red);
        }

        foreach (Edible target in observedEdibles)
        {
            if (target == null)
            {
                return;
            }

            Vector3 dirToTarget = (target.transform.position - transform.position).normalized;
            float   dstToTarget = Vector3.Distance(transform.position, target.transform.position);
            DebugExtension.DebugArrow(this.transform.position, dirToTarget * dstToTarget, Color.blue);
        }
    }
Example #2
0
 // Update is called once per frame
 void Update()
 {
     DebugExtension.DebugPoint(debugPoint_Position, debugPoint_Color, debugPoint_Scale);
     DebugExtension.DebugBounds(new Bounds(new Vector3(10, 0, 0), debugBounds_Size), debugBounds_Color);
     DebugExtension.DebugCircle(new Vector3(20, 0, 0), debugCircle_Up, debugCircle_Color, debugCircle_Radius);
     DebugExtension.DebugWireSphere(new Vector3(30, 0, 0), debugWireSphere_Color, debugWireSphere_Radius);
     DebugExtension.DebugCylinder(new Vector3(40, 0, 0), debugCylinder_End, debugCylinder_Color, debugCylinder_Radius);
     DebugExtension.DebugCone(new Vector3(50, 0, 0), debugCone_Direction, debugCone_Color, debugCone_Angle);
     DebugExtension.DebugArrow(new Vector3(60, 0, 0), debugArrow_Direction, debugArrow_Color);
     DebugExtension.DebugCapsule(new Vector3(70, 0, 0), debugCapsule_End, debugCapsule_Color, debugCapsule_Radius);
 }
Example #3
0
    public void DebugDraw()
    {
        Bounds bound1 = new Bounds(transform.position + groundCheckOffset, groundCheckSize);
        Bounds bound2 = new Bounds(transform.position + groundCheckOffsetAir, groundCheckSizeAir);

        if (isGrounded)
        {
            DebugExtension.DebugBounds(bound1, Color.red);
        }
        else
        {
            DebugExtension.DebugBounds(bound2, Color.red);
        }

        DebugExtension.DebugCone(transform.position, -transform.forward);
    }
Example #4
0
 /// <summary>
 ///     - Debugs an arrow.
 /// </summary>
 /// <param name='position'>
 ///     - The start position of the arrow.
 /// </param>
 /// <param name='direction'>
 ///     - The direction the arrow will point in.
 /// </param>
 /// <param name='color'>
 ///     - The color of the arrow.
 /// </param>
 /// <param name='duration'>
 ///     - How long to draw the arrow.
 /// </param>
 /// <param name='depthTest'>
 ///     - Whether or not the arrow should be faded when behind other objects.
 /// </param>
 public static void DebugArrow(Vector3 position, Vector3 direction, Color color, float duration = 0, bool depthTest = true)
 {
     Debug.DrawRay(position, direction, color, duration, depthTest);
     DebugExtension.DebugCone(position + direction, -direction * 0.333f, color, 15, duration, depthTest);
 }
Example #5
0
 /// <summary>
 /// Draw a cone gizmo with a specified position, direction, length and angle. Editor only.
 /// </summary>
 /// <param name="positionWS">Cone start position in world space.</param>
 /// <param name="direction">Cone direction.</param>
 /// <param name="length">Cone length.</param>
 /// <param name="angle">Cone angle.</param>
 /// <param name="color">Gizmo colors.</param>
 public static void DrawCone(Vector3 positionWS, Vector3 direction, float length, float angle, PortalDebugColor color)
 {
     DebugExtension.DebugCone(positionWS, Vector3.Scale(direction, new Vector3(length, length, length)), color.wire, angle, 0);
 }
Example #6
0
 public static void DrawCone(Vector3 position, Vector3 direction, float angle)
 {
     DebugExtension.DebugCone(position, Vector3.Scale(direction, new Vector3(10, 10, 10)), DebugColors.visualiser[0], angle, 0);
 }