Ejemplo n.º 1
0
        void OnDrawGizmosSelected()
        {
            if (_nearestObstacle != null)
            {
                Vector2 sensorPosition = _sensor.transform.position;

                DrawUtil.DrawLine(sensorPosition, _nearestIntersectGlobal, Color.red);
                DrawUtil.DrawCrosshair(_nearestIntersectGlobal, 1f, Color.red, 0f);

                Vector2 obstacleCenter = _nearestObstacle.bounds.center;
                float   obstacleRadius = getExtendedBoundsRadius(_nearestObstacle);

                // Draw obstacle
                DrawUtil.DrawCircle(obstacleCenter, obstacleRadius, Color.red);
                DrawUtil.DrawCrosshair(obstacleCenter, 0.3f, Color.red);
            }
        }
Ejemplo n.º 2
0
        void OnDrawGizmosSelected()
        {
            Vector2 agentPosition = Agent.transform.position;

            // Draw the whiskers
            DrawUtil.DrawRay(agentPosition, mainWhiskerDirection, mainWhiskerLength, Color.red);
            DrawUtil.DrawRay(agentPosition, rightWhiskerDirection, sideWhiskerLength, Color.red);
            DrawUtil.DrawRay(agentPosition, leftWhiskerDirection, sideWhiskerLength, Color.red);

            // Draw the hit that the agent is trying to avoid.
            if (_closestHit.collider != null)
            {
                DrawUtil.DrawLine(agentPosition, _closestHit.point, Color.red);
                DrawUtil.DrawCrosshair(_closestHit.point, 0.3f, Color.red);

                DrawUtil.DrawRay(_closestHit.point, _closestHit.normal, 2f, Color.cyan);
            }
        }
Ejemplo n.º 3
0
        void OnDrawGizmosSelected()
        {
            if (!active)
            {
                return;
            }

            if (transform.hasChanged)
            {
                updateWander();
            }

            // Draw connection between wander circle and the agent.
            DrawUtil.DrawLine(Agent.transform.position, _wanderCenter, Color.green);

            // Draw the wander properies, such as the target, radius, and wander center.
            DrawUtil.DrawLine(_wanderCenter, _wanderTarget, Color.green);
            DrawUtil.DrawCrosshair(_wanderTarget, 1f, Color.yellow);
            DrawUtil.DrawCircle(_wanderCenter, wanderRadius, Color.green);
        }
Ejemplo n.º 4
0
        public void DrawGizmos()
        {
            for (int i = 0; i < Size - 1; ++i)
            {
                Vector2 start = waypoints[i];
                Vector2 end   = waypoints[i + 1];

                // Draw a line segment between the waypoints.
                DrawUtil.DrawArrow(start, end, Color.cyan, 0.35f);

                // Draw the near threshold.
                DrawUtil.DrawCircle(start, nearWaypointThresh, Color.blue);
            }

            // Draw the near threshold for last waypoint since the loop only goes to Length-1.
            DrawUtil.DrawCircle(LastWaypoint, nearWaypointThresh, Color.blue);

            // Draw a line segment between the end and start waypoints.
            if (bLoop)
            {
                DrawUtil.DrawArrow(LastWaypoint, FirstWaypoint, Color.cyan, 0.35f);
            }
        }
Ejemplo n.º 5
0
 protected void drawSensorBounds()
 {
     DrawUtil.DrawCircle(Agent.transform.position, sensorRadius, Color.red);
 }