예제 #1
0
        public void OnRenderObject()
        {
            NavDebug.Draw(mHelper.mesh, mPolyRef, 1);

            Color c = QEUtil.SelectColor;

            c.a = 0.25f;

            if (mHasPosition)
            {
                DebugDraw.DiamondMarker(mPosition.point, QEUtil.MarkerScaleNorm, c);
            }

            if (mHasNearestPoint)
            {
                c   = NavDebug.goalColor;
                c.a = 0.25f;

                DebugDraw.DiamondMarker(mNearest.point, QEUtil.MarkerScaleNorm, c);

                DebugDraw.Arrow(mPosition.point, mNearest.point
                                , 0, QEUtil.HeadScaleNorm
                                , NavDebug.goalColor);
            }
        }
예제 #2
0
        public void OnRenderObject()
        {
            NavDebug.Draw(mHelper.mesh, mPolyRefs.buffer, mResultCount);

            if (mHasPosition)
            {
                DebugDraw.Circle(mPosition.point, mSearchRadius, QEUtil.SelectColor);
            }

            if (mResultCount > 0)
            {
                for (int i = 0; i < mResultCount; i++)
                {
                    if (mParentRefs[i] == 0)
                    {
                        continue;
                    }

                    Vector3 center = GetBufferedCentroid(mPolyRefs.buffer[i]);
                    Vector3 pcenter;

                    if (mParentRefs[i] == mPosition.polyRef)
                    {
                        pcenter = mPosition.point;
                    }
                    else
                    {
                        pcenter = GetBufferedCentroid(mParentRefs[i]);
                    }

                    DebugDraw.Arrow(pcenter, center, 0, QEUtil.HeadScaleSm, NavDebug.goalColor);
                }
            }
        }
 void OnRenderObject()
 {
     if (m_RotationDisc)
     {
         var color = ColorUtil.Chocolate;
         var trans = m_Manager.Body.MotionRoot;
         var dist  = 0.5f;
         var pos   = trans.position + Vector3.up * 0.005f;
         DebugDraw.Circle(pos, dist, color);
         DebugDraw.Arrow(pos, pos + trans.forward * dist, 0, 0.1f, color);
     }
 }
예제 #4
0
    void OnRenderObject()
    {
        if (!mDebugEnabled || mAgent == null)
        {
            return;
        }

        if (mAgent.crowdAgent != null)
        {
            if (mCrowdDebug == null)
            {
                mCorners    = null;
                mCorridor   = null;
                mCrowdDebug = new CrowdAgentDebug(mAgent.navGroup.crowd.Navmesh);
            }
            mCrowdDebug.DrawAll(mAgent.crowdAgent);
        }
        else if ((mAgent.data.flags & NavFlag.CorridorInUse) != 0)
        {
            if (mCorridor == null)
            {
                mCorners    = new CornerData();
                mCorridor   = new PathCorridorData(mAgent.corridor.MaxPathSize);
                mCrowdDebug = null;
            }
            int n = mAgent.corridor.FindCorners(mCorners);
            mCorners.cornerCount = n; // v0.3.0 bug workaround.
            mAgent.corridor.GetData(mCorridor);
            NavDebug.Draw(mAgent.navGroup.mesh, mCorridor);
            NavDebug.Draw(mCorners);
        }

        if (mAgent.crowdAgent == null)
        {
            Vector3 pos    = mAgent.data.position.point;
            float   height = mAgent.crowdConfig.height; // Might be zero.

            Vector3 velocity = mAgent.data.desiredVelocity;
            DebugDraw.Arrow(pos + Vector3.up * height
                            , pos + velocity + Vector3.up * height
                            , 0, 0.05f, CrowdAgentDebug.desiredVelocityColor);
        }

        DebugDraw.DiamondMarker(mAgent.data.position.point
                                , 0.1f
                                , NavDebug.positionColor);

        DebugDraw.DiamondMarker(mAgent.data.goal.point
                                , 0.1f
                                , NavDebug.goalColor);
    }
예제 #5
0
        /// <summary>
        /// Draws the basic agent debug information.
        /// </summary>
        /// <remarks>
        /// <para>
        /// This does not include the duplicate agent information such as target and corner
        /// positions.
        /// </para>
        /// </remarks>
        /// <param name="agent">The agent to draw.</param>
        public void DrawBase(CrowdAgent agent)
        {
            Vector3          pos    = agent.Position;
            CrowdAgentParams config = agent.GetConfig();

            DebugDraw.Circle(pos, config.radius, neighborColor);

            DebugDraw.Arrow(pos + Vector3.up * config.height
                            , pos + agent.DesiredVelocity + Vector3.up * config.height
                            , 0, 0.05f, desiredVelocityColor);

            DebugDraw.Arrow(pos + Vector3.up * config.height
                            , pos + agent.Velocity + Vector3.up * config.height
                            , 0, 0.05f, velocityColor);
        }
예제 #6
0
        public void OnRenderObject()
        {
            NavDebug.Draw(mHelper.mesh, false);

            if (mHasPosition)
            {
                DebugDraw.Circle(mPosition.point, mSearchRadius, QEUtil.SelectColor);
            }

            if (mHasWallHit)
            {
                DebugDraw.DiamondMarker(mWallHitPoint, QEUtil.MarkerScaleSm, Color.green);

                Vector3 normal = (mWallHitPoint + mWallNormal);
                DebugDraw.Arrow(mWallHitPoint, normal, 0, QEUtil.HeadScaleSm, NavDebug.goalColor);
            }
        }
예제 #7
0
        public void OnRenderObject()
        {
            NavDebug.Draw(mHelper.mesh, mPolyRefs.buffer, mResultCount);

            Color c = QEUtil.SelectColor;

            c.a = 0.25f;

            if (mPosition.polyRef != 0)
            {
                DebugDraw.DiamondMarker(mPosition.point, QEUtil.MarkerScaleNorm, c);
            }

            c   = NavDebug.goalColor;
            c.a = 0.25f;

            if (mGoal.polyRef != 0)
            {
                DebugDraw.DiamondMarker(mGoal.point, QEUtil.MarkerScaleNorm, c);
            }

            if (mResultCount > 0)
            {
                if (mHitParam < 1)
                {
                    Vector3 hitPoint =
                        mPosition.point + (mGoal.point - mPosition.point) * mHitParam;

                    DebugDraw.Arrow(mPosition.point, hitPoint
                                    , 0, QEUtil.HeadScaleNorm
                                    , NavDebug.goalColor);

                    DebugDraw.Arrow(hitPoint, hitPoint + mHitNorm * 0.5f
                                    , 0, QEUtil.HeadScaleSm
                                    , NavDebug.goalColor);
                }
                else
                {
                    DebugDraw.Arrow(mPosition.point, mGoal.point
                                    , 0, QEUtil.HeadScaleNorm
                                    , NavDebug.goalColor);
                }
            }
        }
예제 #8
0
        public void OnRenderObject()
        {
            NavDebug.Draw(mHelper.mesh, mPolyRefs.buffer, mVisitedCount);

            Color c = QEUtil.SelectColor;

            c.a = 0.25f;

            if (mPosition.polyRef != 0)
            {
                DebugDraw.DiamondMarker(mPosition.point, QEUtil.MarkerScaleNorm, c);
            }

            c   = NavDebug.positionColor;
            c.a = 0.25f;

            if (mGoal.polyRef != 0)
            {
                DebugDraw.DiamondMarker(mGoal.point, QEUtil.MarkerScaleNorm, c);
            }

            c   = NavDebug.goalColor;
            c.a = 0.25f;

            if (mVisitedCount > 0)
            {
                DebugDraw.DiamondMarker(mTarget.point, QEUtil.MarkerScaleNorm, c);
            }

            if (mStraightCount > 0)
            {
                for (int i = 1; i < mStraightCount; i++)
                {
                    DebugDraw.Arrow(mStraightPath[i - 1], mStraightPath[i]
                                    , 0, QEUtil.HeadScaleNorm
                                    , NavDebug.goalColor);
                }
            }
        }
예제 #9
0
        /// <summary>
        /// Draws agent neighbor information.
        /// </summary>
        /// <param name="agent">The agent to draw.</param>
        public void DrawNeighbors(CrowdAgent agent)
        {
            int neighborCount = agent.NeighborCount;

            if (neighborCount == 0)
            {
                return;
            }

            agent.GetNeighbors(neighbors);

            for (int i = 0; i < neighborCount; i++)
            {
                CrowdAgent n = agent.GetNeighbor(neighbors[i]);
                if (n == null)
                {
                    // Not sure why this happens.  Bug in CrowdAgent?
                    continue;
                }
                DebugDraw.Arrow(agent.Position, n.Position, 0, 0.05f, neighborColor);
                DebugDraw.Circle(n.Position, agent.GetConfig().radius, neighborColor);
            }
        }
예제 #10
0
        public override void OnRenderObject()
        {
            base.OnRenderObject();

            Color c = NavDebug.positionColor;

            c.a = 0.25f;

            if (mTarget.polyRef != 0)
            {
                DebugDraw.DiamondMarker(mTarget.point, QEUtil.MarkerScaleNorm, c);
            }

            if (mStraightCount > 0)
            {
                for (int i = 1; i < mStraightCount; i++)
                {
                    DebugDraw.Arrow(mStraightPath.buffer[i - 1], mStraightPath.buffer[i]
                                    , 0, QEUtil.HeadScaleSm
                                    , NavDebug.positionColor);
                }
            }
        }
예제 #11
0
    void OnRenderObject()
    {
        if (Time.timeScale == 0 || mGroup.mesh == null)
        {
            return;
        }

        mCorridor.GetData(mCorridorData);
        NavDebug.Draw(mGroup.mesh, false);
        NavDebug.Draw(mGroup.mesh, mCorridorData);
        NavDebug.Draw(mCorridor.Corners);

        Color c = NavDebug.positionColor;

        c.a = 0.25f;

        if (mPathStart.polyRef != 0)
        {
            DebugDraw.DiamondMarker(mPathStart.point, 0.1f, c);
        }

        c   = NavDebug.goalColor;
        c.a = 0.25f;

        if (mPathEnd.polyRef != 0)
        {
            DebugDraw.DiamondMarker(mPathEnd.point, 0.1f, c);
        }

        if (mOptimizeTimer > 0)
        {
            c   = NavDebug.goalColor;
            c.a = mOptimizeTimer / TimerLength;
            DebugDraw.Arrow(mOptimizeStart, mOptimizeEnd, 0, 0.1f, c);
            DebugDraw.Circle(mOptimizeStart, optimizationRange, c);
        }
    }
예제 #12
0
 // Update is called once per frame
 void Update()
 {
     DebugDraw.Arrow(startPoint, direction.normalized, scale, Color.magenta, arrowPoint, duration);
 }