Beispiel #1
0
    public void OnDrawDebug()
    {
#if DEBUG
        Vector3 position = Vector3.zero;
        GetPosition(ref position);
        GLRenderingUtils.DoDrawLine(_gameCameraLookAt, position, Color.green);

        GLRenderingUtils.DoDrawSphere(_gameCameraLookAt, 0.8f, Color.yellow);
        GLRenderingUtils.DoDrawSphere(position, 0.8f, Color.red);
#endif
    }
Beispiel #2
0
    public void OnDrawDebug()
    {
        if (!drawDebug || (AmILocal() && !fakeLocalDebugging))
        {
            return;
        }

        const float SphereRad = 0.3f;

        GLRenderingUtils.DoDrawSphere(_hostPosition, SphereRad * 0.3f, Color.green);
        const float AxisScale = 1.5f;

        GLRenderingUtils.DoDrawScaledAxes(_hostRotation, _hostPosition, AxisScale);

        int trans = Mathf.Max(0, _networkTransforms.Count - maxNetworkTransformsToDraw);         // don't draw more network transforms than required

        for (; trans < _networkTransforms.Count; ++trans)
        {
            if (!drawFutureUpdatesInLoopMode && loopMode && CalculateLoopModeTime() < _networkTransforms[trans].time)
            {
                break;
            }

            NetworkTransform temp = _networkTransforms[trans];

            GLRenderingUtils.DoDrawSphere(temp.position, SphereRad, Color.red);                                                                 // draw the position of this network transform

            GLRenderingUtils.DoDrawLine(temp.position, temp.position + temp.predictedVelocity * GetNetworkUpdateInterval(), Color.green);       // draw a line from this network transform position to predicted velocity end
            GLRenderingUtils.DoDrawSphere(temp.position + temp.predictedVelocity * GetNetworkUpdateInterval(), SphereRad * 0.5f, Color.yellow); // draw a line at the end of the predicted velocity

            GLRenderingUtils.DoDrawSphere(temp.extrapolatedPosition, SphereRad * 0.5f, Color.blue);                                             // where hs the position been extrapolated to upto now

            if (trans > 0)
            {
                NetworkTransform prev = _networkTransforms[trans - 1];
                GLRenderingUtils.DoDrawLine(temp.position, prev.position, Color.white);                 // draw a line to the previous network update position
            }
        }
    }
Beispiel #3
0
    private void DrawEdges()
    {
        if (closeDistanceEdges > 0f || doDrawEdgeNormals)
        {
            PlayerController player = PlayerManager.LocalPlayerController();
            if (null != player)
            {
                if (closeDistanceEdges > 0f)
                {
                    GLRenderingUtils.DoDrawSphere(player.transform.position, closeDistanceEdges, Color.red);
                }

                List <ObstacleVertex> obstacles = new List <ObstacleVertex>();
                GetSimulator().GetStaticAndDynamicObstacles(obstacles, player.transform.position, closeDistanceEdges * closeDistanceEdges);

                GL.Begin(GL.LINES);
                for (int i = 0; i < obstacles.Count; i++)
                {
                    DrawObstacleAndNormal(obstacles[i], closeDistanceEdges > 0f, doDrawEdgeNormals, doDrawEdgeTop, Color.black);
                }
                GL.End();
            }
        }
    }