예제 #1
0
 public static void DebugDraw()
 {
     foreach (var pair in CurrentBotsAttackingPlayer)
     {
         MySmallShipBot bot = pair.Value;
         MyDebugDraw.DrawSphereWireframe(bot.GetPosition(), bot.WorldVolume.Radius, new Vector3(1, 0, 0), 1);
     }
 }
 public override bool DebugDraw()
 {
     foreach (BoundingSphere sphere in m_debugVoxelSpheres)
     {
         MyDebugDraw.DrawSphereWireframe(sphere.Center, sphere.Radius, Color.Green.ToVector3(), 1);
     }
     return(base.DebugDraw());
 }
예제 #3
0
        public override void DebugDrawDeactivated()
        {
            if (Activated || !Visible)
            {
                return;
            }

            MyDebugDraw.DrawSphereWireframe(Matrix.CreateScale(RadiusMax) * WorldMatrix, Color.Green.ToVector3(), 1f);
        }
 internal override void DebugDraw()
 {
     if (m_path != null && m_path.Count > 0)
     {
         MyDebugDraw.DrawSphereWireframe(m_path[0].Position, 2, new Vector3(0, 1, 1), 1);
         for (int i = 1; i < m_path.Count; i++)
         {
             MyDebugDraw.DrawSphereWireframe(m_path[i].Position, 2, new Vector3(0, 1, 1), 1);
             MyDebugDraw.DrawLine3D(m_path[i - 1].Position, m_path[i].Position, Color.Blue, Color.Cyan);
         }
     }
 }
예제 #5
0
        private static void DebugDrawLights()
        {
            return;

            //Debug draw lights
            foreach (MyRenderLight light in m_renderLightsForDraw)
            {
                //if (light.LightOn && light.Glare.Type == TransparentGeometry.MyLightGlare.GlareTypeEnum.Distant)
                {
                    if ((light.LightType & LightTypeEnum.PointLight) != 0)
                    {
                        MyDebugDraw.DrawSphereWireframe(MatrixD.CreateScale(light.Range) * MatrixD.CreateTranslation(light.PositionWithOffset), Color.Red, 1);
                        MyDebugDraw.DrawAxis(MatrixD.CreateWorld(light.Position, light.ReflectorDirection, light.ReflectorUp), 2, 1, false);
                        // MyDebugDraw.DrawText(light.PositionWithOffset, new System.Text.StringBuilder(light.ID.ToString()), Color.White, 1);
                    }
                    //if ((light.LightType & LightTypeEnum.Hemisphere) != 0)
                    //{
                    //    Matrix rotationHotfix = Matrix.CreateFromAxisAngle(Vector3.UnitX, MathHelper.PiOver2);
                    //    Matrix world = Matrix.CreateScale(light.Range) * rotationHotfix * Matrix.CreateWorld(light.Position, light.ReflectorDirection, light.ReflectorUp);
                    //    MyDebugDraw.DrawHemisphereWireframe(world, new Vector3(1, 0, 0), 1);
                    //}
                    if ((light.LightType & LightTypeEnum.Spotlight) != 0)
                    {
                        // Uncomment to show sphere for spot light
                        //MyDebugDraw.DrawSphereWireframe(Matrix.CreateScale(light.ReflectorRange) * Matrix.CreateTranslation(light.Position), new Vector3(color.X, color.Y, color.Z), 0.25f);

                        //MyDebugDraw.DrawCapsule(light.Position, light.Position + light.ReflectorDirection * light.ReflectorRange, 1, new Color(color.X, color.Y, color.Z), false);

                        //float reflectorConeAngle = (float)System.Math.Acos(1 - light.ReflectorConeMaxAngleCos);
                        //float reflectorRadius = (float)System.Math.Tan(reflectorConeAngle) * light.ReflectorRange;
                        //MyDebugDraw.DrawCylinder(light.Position, light.Position + light.ReflectorDirection * light.ReflectorRange, 0, reflectorRadius, new Color(color.X, color.Y, color.Z), false);

//                        MyDebugDraw.DrawText(light.Position, new System.Text.StringBuilder(light.ShadowMapIndex.ToString() + " (" + (light.SpotQuery != null ? light.QueryPixels.ToString() : "") + ")" ), Color.Yellow, 0.8f, false);

                        MyDebugDraw.DrawText(light.Position, new System.Text.StringBuilder(Vector3D.Distance(MyRenderCamera.Position, light.Position).ToString()), Color.Yellow, 0.8f, false);

                        MyStateObjects.WireframeClockwiseRasterizerState.Apply();
                        DepthStencilState.None.Apply();



                        MyDebugDraw.DrawModel(MyDebugDraw.ModelCone, light.SpotWorld, Color.White, false);
                    }

                    //just glare
                    if (light.LightType == LightTypeEnum.None)
                    {
                        MyDebugDraw.DrawSphereWireframe(MatrixD.CreateScale(light.Range) * MatrixD.CreateTranslation(light.PositionWithOffset), Color.Red, 1);
                    }
                }
            }
        }
예제 #6
0
        public override bool DebugDraw()
        {
            if (!base.DebugDraw())
            {
                return(false);
            }

            if (MyMwcFinalBuildConstants.DrawHelperPrimitives)
            {
                MyDebugDraw.DrawSphereWireframe(GetPosition(), 0.1f, new Vector3(0, 1, 0), 1);
                MyDebugDraw.DrawAxis(WorldMatrix, 5, 1);
            }

            return(true);
        }
예제 #7
0
        public static void DebugDraw()
        {
            return;

            //  Update helper frustum and then its bounding box
            m_helperBoundingSphere = new BoundingSphere(MySession.PlayerShip.GetPosition(), MaxDistance);
            BoundingBox helperBoundingBox = BoundingBox.CreateFromSphere(m_helperBoundingSphere);

            MyMwcVector3Int minCoord = GetMetersToDustFieldCoord(ref helperBoundingBox.Min);
            MyMwcVector3Int maxCoord = GetMetersToDustFieldCoord(ref helperBoundingBox.Max);

            List <MyMwcVector3Int> entitiesToRemove = new List <MyMwcVector3Int>(m_usedCoords.Keys);

            MyMwcVector3Int tempCoord;

            for (tempCoord.X = minCoord.X; tempCoord.X <= maxCoord.X; tempCoord.X++)
            {
                for (tempCoord.Y = minCoord.Y; tempCoord.Y <= maxCoord.Y; tempCoord.Y++)
                {
                    for (tempCoord.Z = minCoord.Z; tempCoord.Z <= maxCoord.Z; tempCoord.Z++)
                    {
                        //  Position of this particle
                        Vector3 position;
                        position.X = tempCoord.X * DistanceBetween;
                        position.Y = tempCoord.Y * DistanceBetween;
                        position.Z = tempCoord.Z * DistanceBetween;

                        float   distance;
                        Vector3 center = MySession.PlayerShip.GetPosition();
                        //Vector3 center = new Vector3(m_random[0][0][0], m_random[0][0][1], m_random[0][0][2]);

                        Vector3.Distance(ref center, ref position, out distance);

                        if (distance > MaxDistance)
                        {
                            continue;
                        }

                        /*
                         * BoundingBox bbox = new BoundingBox(position - new Vector3(DistanceBetweenHalf),position + new Vector3(DistanceBetweenHalf));
                         * Vector4 color = new Vector4(0,1,0,1);
                         * MyDebugDraw.DrawAABBLowRes(ref bbox, ref color, 1.0f);*/

                        MyDebugDraw.DrawSphereWireframe(position, 1, Vector3.One, 1);
                    }
                }
            }
        }
예제 #8
0
        public override bool DebugDraw()
        {
            Vector4 color  = Vector4.One;
            Vector3 color2 = Vector3.One;

            if (ParticleEffect != null && IsVisible() && Enabled)
            {
                //MyDebugDraw.DrawAABB(ref m_worldAABB, ref color, 1);
            }

            if (m_smallShipDetector != null)
            {
                MyDebugDraw.DrawSphereWireframe(GetPosition(), m_smallShipDetector.Radius, color2, 1);
            }

            return(base.DebugDraw());
        }
예제 #9
0
        public void DebugDraw()
        {
            MyDebugDraw.DrawAxis(WorldMatrix, 1.0f, 1.0f);
            MyDebugDraw.DrawSphereWireframe(WorldMatrix.Translation, 0.1f, Vector3.One, 1.0f);

            foreach (MyParticleGeneration generation in m_generations)
            {
                generation.DebugDraw();
            }

            Color color = !m_isStopped ? Color.White : Color.Red;

            MyDebugDraw.DrawText(WorldMatrix.Translation, new System.Text.StringBuilder(GetID().ToString() + " [" + GetParticlesCount().ToString() + "]"), color, 1.0f);

            // Vector4 colorV = color.ToVector4();
            // MyDebugDraw.DrawAABB(ref m_AABB, ref colorV, 1.0f);
        }
예제 #10
0
        public void DebugDrawRange()
        {         /*
                   * Matrix world = Matrix.CreateWorld(WorldMatrix.Translation, WorldMatrix.Forward, WorldMatrix.Up);
                   * Vector4 color = Color.Blue.ToVector4();
                   * color.W *= 0.1f;
                   * MySimpleObjectDraw.DrawTransparentSphere(ref world, SearchingDistance, ref color, true, 24);
                   */
            float distance          = 5000;
            float minSearchDistance = 5000;

            if ((Vector3.Distance(MyCamera.Position, this.GetPosition()) < distance) &&
                (SearchingDistance < minSearchDistance))
            {
                Matrix  world = Matrix.CreateWorld(WorldMatrix.Translation, WorldMatrix.Forward, WorldMatrix.Up);
                Vector3 color = Color.Blue.ToVector3();
                MyDebugDraw.DrawSphereWireframe(world.Translation, SearchingDistance, color, 1f);
            }
        }
예제 #11
0
        public override void DebugDrawDeactivated()
        {
            if (Activated || !Visible)
            {
                return;
            }

            Vector3 colorToDraw = MinerWarsMath.Color.Green.ToVector3();
            float   alpha       = 1f;

            if (Type == MyDummyPointType.Box)
            {
                MyDebugDraw.DrawHiresBoxWireframe(Matrix.CreateScale(LocalAABB.Size()) * WorldMatrix, colorToDraw, alpha);
            }
            else
            {
                MyDebugDraw.DrawSphereWireframe(Matrix.CreateScale(Radius) * WorldMatrix, colorToDraw, alpha);
            }
        }
예제 #12
0
        public override bool DebugDraw()
        {
            return(false);

            bool retVal = base.DebugDraw();

            if (retVal)
            {
                //MyDebugDraw.DrawLine3D(WorldMatrix.Translation, m_headPositionTransformed, Color.Red, Color.Red);

                float length = Vector3.Distance(WorldMatrix.Translation, m_headPositionTransformed);
                float scale  = (length / (2 * ModelLod0.BoundingSphere.Radius));

                //float scale = GetScaleMatrix().Forward.Length();
                MyDebugDraw.DrawLine3D(WorldMatrix.Translation, WorldMatrix.Translation + length * WorldMatrix.Forward, Color.Red, Color.Red);

                MyDebugDraw.DrawSphereWireframe(Matrix.CreateScale(m_harvestingOreHead.ModelLod0.BoundingSphere.Radius) *
                                                Matrix.CreateTranslation(m_headPositionTransformed), new Vector3(0, 1, 0), 0.6f);
            }

            return(true);
        }
예제 #13
0
        public static void DebugDraw()
        {
            MyLights.UpdateSortedLights(ref MyCamera.BoundingSphere, false);

            foreach (MyLight light in m_sortedLights)
            {
                //if (light.LightOn && light.Glare.Type == TransparentGeometry.MyLightGlare.GlareTypeEnum.Distant)
                {
                    if ((light.LightType & MyLight.LightTypeEnum.PointLight) != 0)
                    {
                        MyDebugDraw.DrawSphereWireframe(Matrix.CreateScale(light.Range) * Matrix.CreateTranslation(light.PositionWithOffset), new Vector3(1, 0, 0), 1);
                    }
                    if ((light.LightType & MyLight.LightTypeEnum.Hemisphere) != 0)
                    {
                        Matrix rotationHotfix = Matrix.CreateFromAxisAngle(Vector3.UnitX, MathHelper.PiOver2);
                        Matrix world          = Matrix.CreateScale(light.Range) * rotationHotfix * Matrix.CreateWorld(light.Position, light.ReflectorDirection, light.ReflectorUp);
                        MyDebugDraw.DrawHemisphereWireframe(world, new Vector3(1, 0, 0), 1);
                    }
                    if ((light.LightType & MyLight.LightTypeEnum.Spotlight) != 0 /* && light.ReflectorOn*/)
                    {
                        Vector4 color = Color.Aqua.ToVector4();
                        // MyDebugDraw.DrawAABB(ref bb, ref color, 1.0f);

                        MyDebugDraw.DrawAxis(Matrix.CreateWorld(light.Position, Vector3.Up, Vector3.Forward), 2, 1);
                        MyDebugDraw.DrawSphereWireframe(Matrix.CreateScale(light.Range) * Matrix.CreateTranslation(light.PositionWithOffset), new Vector3(1, 0, 0), 1);

                        // Uncomment to show sphere for spot light
                        //MyDebugDraw.DrawSphereWireframe(Matrix.CreateScale(light.ReflectorRange) * Matrix.CreateTranslation(light.Position), new Vector3(color.X, color.Y, color.Z), 0.25f);
                        //MySimpleObjectDraw.DrawConeForLight();
                        MyStateObjects.WireframeRasterizerState.Apply();
                        SharpDX.Toolkit.Graphics.DepthStencilState.None.Apply();

                        MyDebugDraw.DrawModel(MySimpleObjectDraw.ModelCone, light.SpotWorld, Vector3.One, 1);
                    }
                }
            }
        }
예제 #14
0
        public override bool DebugDraw()
        {
            if (!base.DebugDraw())
            {
                return(false);
            }

            if (DRAW_DEBUG_INFORMATION)
            {
                m_debugDrawSb.Clear();

                m_debugDrawSb.Append("Is working:");
                m_debugDrawSb.Append(IsWorking());
                m_debugDrawSb.AppendLine();

                m_debugDrawSb.Append("Enabled:");
                m_debugDrawSb.Append(Enabled);
                m_debugDrawSb.AppendLine();

                m_debugDrawSb.Append("Detected entities:");
                m_debugDrawSb.AppendInt32(m_sensorHandler.GetDetectedEntitiesCount());
                m_debugDrawSb.AppendLine();

                m_debugDrawSb.Append("Sensor interactions:");
                m_debugDrawSb.AppendInt32(m_sensor.m_Interactions.Count);
                m_debugDrawSb.AppendLine();

                KinematicPrefabStateEnum?state = null;
                bool?isOpened = null;
                bool?isClosed = null;
                foreach (var part in Parts)
                {
                    if (part != null)
                    {
                        Debug.Assert(state == null || state.Value == part.GetState());
                        Debug.Assert(isOpened == null || isOpened.Value == part.IsOpened());
                        Debug.Assert(isClosed == null || isClosed.Value == part.IsClosed());
                        state    = part.GetState();
                        isOpened = part.IsOpened();
                        isClosed = part.IsClosed();
                    }
                }
                if (state != null && isOpened != null && isClosed != null)
                {
                    m_debugDrawSb.Append("State:");
                    switch (state.Value)
                    {
                    case KinematicPrefabStateEnum.Closing:
                        m_debugDrawSb.Append("Closing");
                        break;

                    case KinematicPrefabStateEnum.Opening:
                        m_debugDrawSb.Append("Opening");
                        break;

                    case KinematicPrefabStateEnum.Sleeping:
                        m_debugDrawSb.Append("Sleeping");
                        break;
                    }
                    m_debugDrawSb.AppendLine();
                    m_debugDrawSb.Append("IsOpened:");
                    m_debugDrawSb.Append(isOpened.Value);
                    m_debugDrawSb.AppendLine();
                    m_debugDrawSb.Append("IsClosed:");
                    m_debugDrawSb.Append(isClosed.Value);
                }


                MyDebugDraw.DrawText(WorldVolume.Center, m_debugDrawSb, Color.White, 0.5f);

                float radius = DETECTION_ANGLE != null ? DETECT_RADIUS * 0.5f : DETECT_RADIUS;
                MyDebugDraw.DrawSphereWireframe(WorldVolume.Center, radius, new Vector3(0f, 1f, 0f), 0.5f);
                if (DETECTION_ANGLE != null)
                {
                    float radius2 = (float)Math.Tan(DETECTION_ANGLE.Value) * DETECT_RADIUS;
                    Color color   = Color.Red;
                    color.A = 55;
                    MyDebugDraw.DrawCone(WorldVolume.Center, WorldVolume.Center + WorldMatrix.Forward * DETECT_RADIUS, radius2, color);
                    MyDebugDraw.DrawCone(WorldVolume.Center, WorldVolume.Center + WorldMatrix.Backward * DETECT_RADIUS, radius2, color);
                    //MyDebugDraw.DrawSphereWireframe(WorldVolume.Center, DETECT_RADIUS, color.ToVector3(), 0.3f);
                }
            }

            return(true);
        }
예제 #15
0
        public void DebugDraw(float elapsedTime, Matrix worldMatrix)
        {
            Vector3 currentOffsetUntransformed, currentOffset;

            Offset.GetInterpolatedValue <Vector3>(elapsedTime, out currentOffsetUntransformed);
            Vector3.Transform(ref currentOffsetUntransformed, ref worldMatrix, out currentOffset);
            float currentSize;

            Size.GetInterpolatedValue <float>(elapsedTime, out currentSize);

            switch (Type)
            {
            case MyParticleEmitterType.Point:
            {
                MyDebugDraw.DrawSphereWireframe(currentOffset, 0.1f, new Vector3(1, 1, 0), 1.0f);
            }
            break;

            case MyParticleEmitterType.Line:
            {
                if (DirToCamera)
                {
                    Vector3 dir = MyCamera.Position - currentOffset;
                    dir.Normalize();
                    Matrix  matrix = Matrix.CreateScale(currentSize) * MyMath.MatrixFromDir(dir);
                    Vector3 currentOffsetScaled = Vector3.TransformNormal(Vector3.Forward, matrix);
                    MyDebugDraw.DrawLine3D(worldMatrix.Translation, worldMatrix.Translation + currentOffsetScaled, Color.Yellow, Color.Yellow);
                }
                else
                {
                    Vector3 currentOffsetScaled = Vector3.Transform(Vector3.Up * currentSize, worldMatrix);
                    MyDebugDraw.DrawLine3D(worldMatrix.Translation, currentOffsetScaled, Color.Yellow, Color.Yellow);
                }
            }
            break;

            case MyParticleEmitterType.Sphere:
            {
                MyDebugDraw.DrawSphereWireframe(currentOffset, currentSize, new Vector3(1, 1, 0), 1.0f);
            }
            break;

            case MyParticleEmitterType.Box:
            {
                Matrix matrix = Matrix.CreateScale(currentSize) * Matrix.CreateTranslation(currentOffsetUntransformed) * worldMatrix;
                MyDebugDraw.DrawLowresBoxWireframe(matrix, new Vector3(1, 1, 0), 1.0f);
            }
            break;

            case MyParticleEmitterType.Hemisphere:
            {
                Vector3 worldPos = currentOffset;

                Matrix matrix;

                if (DirToCamera)
                {
                    Matrix WorldView = worldMatrix * MyCamera.ViewMatrix;
                    WorldView.Translation += currentOffsetUntransformed;
                    Matrix newWorld = WorldView * Matrix.Invert(MyCamera.ViewMatrix);

                    Vector3 dir = MyCamera.Position - newWorld.Translation;
                    dir.Normalize();

                    matrix             = Matrix.CreateScale(currentSize) * Matrix.CreateRotationX(MathHelper.PiOver2) * MyMath.MatrixFromDir(dir);
                    matrix.Translation = newWorld.Translation;
                }
                else
                {
                    matrix = Matrix.CreateScale(currentSize) * Matrix.CreateTranslation(currentOffsetUntransformed) * worldMatrix;
                }

                MyDebugDraw.DrawHemisphereWireframe(matrix, new Vector3(1, 1, 0), 1.0f);
            }
            break;

            case MyParticleEmitterType.Circle:
            {
                //No debug draw
            }
            break;

            default:
                System.Diagnostics.Debug.Assert(false);
                break;
            }
        }
예제 #16
0
        /// <summary>
        /// Debug draw of this physics object.
        /// </summary>
        public void DebugDraw()
        {
            const float alpha = 0.3f;

            if (!Enabled)
            {
                return;
            }

            foreach (var primitive in this.rigidBody.GetRBElementList())
            {
                MyRBElementType type = primitive.GetElementType();

                switch (type)
                {
                case MyRBElementType.ET_BOX:
                {
                    var box = (MyRBBoxElement)primitive;

                    MyDebugDraw.DrawHiresBoxWireframe(
                        Matrix.CreateScale(box.Size) * box.GetGlobalTransformation(),
                        Color.Green.ToVector3(), alpha);
                }
                break;

                case MyRBElementType.ET_SPHERE:
                {
                    var sphere = (MyRBSphereElement)primitive;

                    MyDebugDraw.DrawSphereWireframe(
                        Matrix.CreateScale(sphere.Radius) * sphere.GetGlobalTransformation(),
                        Color.Green.ToVector3(), alpha);
                }
                break;

                case MyRBElementType.ET_TRIANGLEMESH:
                {
                    var triMesh = (MyRBTriangleMeshElement)primitive;
                    var model   = triMesh.Model;

                    Matrix transformMatrix = this.rigidBody.Matrix;

                    MyDebugDrawCachedLines.Clear();

                    //  This is just a reserve
                    const int numberOfAddTrianglesInLoop = 3;

                    int triangleIndex = 0;
                    while (true)
                    {
                        //bool finished = triangleIndex >= mesh.GetNumTriangles();
                        bool finished = triangleIndex >= model.GetTrianglesCount();

                        if ((MyDebugDrawCachedLines.IsFull(-numberOfAddTrianglesInLoop)) || (finished))
                        {
                            MyDebugDrawCachedLines.DrawLines();
                            MyDebugDrawCachedLines.Clear();
                        }

                        if (finished)
                        {
                            break;
                        }

                        MyTriangleVertexIndices triangle = model.Triangles[triangleIndex];

                        //  We now transform the triangleVertexes into world space (we could keep leave the mesh alone
                        //  but at this point 3 vector transforms is probably not a major slow down)
                        Vector3 triVec0 = model.GetVertex(triangle.I0);
                        Vector3 triVec1 = model.GetVertex(triangle.I2);
                        Vector3 triVec2 = model.GetVertex(triangle.I1);

                        // Move triangle into world space
                        Vector3.Transform(ref triVec0, ref transformMatrix, out triVec0);
                        Vector3.Transform(ref triVec1, ref transformMatrix, out triVec1);
                        Vector3.Transform(ref triVec2, ref transformMatrix, out triVec2);

                        MyDebugDrawCachedLines.AddLine(triVec0, triVec1, Color.Green, Color.Green);
                        MyDebugDrawCachedLines.AddLine(triVec1, triVec2, Color.Green, Color.Green);
                        MyDebugDrawCachedLines.AddLine(triVec2, triVec0, Color.Green, Color.Green);

                        /*
                         * MyTriangle_Vertexes tv = new MyTriangle_Vertexes();
                         * tv.Vertex0 = triVec0;
                         * tv.Vertex1 = triVec1;
                         * tv.Vertex2 = triVec2;
                         * Vector3 calculatedTriangleNormal = MyUtils.GetNormalVectorFromTriangle(ref tv);
                         * Vector3 center = (triVec0 + triVec1 + triVec2)/3.0f;
                         * MyDebugDrawCachedLines.AddLine(center, center + calculatedTriangleNormal * 5, Color.Red, Color.Red);
                         */

                        //MyDebugDraw.AddDrawTriangle(triVec0, triVec1, triVec2, new Color(0,0.8f, 0, 0.1f));

                        triangleIndex++;
                    }
                }
                break;
                }
            }
        }
예제 #17
0
        public override bool DebugDraw()
        {
            /*
             * m_targetEntities.Clear();
             *
             * Matrix proj = Matrix.CreateOrthographic(300, 300, 0, 1000);
             * Matrix view = Matrix.CreateLookAt(GetPosition(), GetPosition() + WorldMatrix.Forward, WorldMatrix.Up);
             * m_visualFrustum.Matrix = view * proj;
             *
             * //MyEntities.GetIntersectionWithSphere(ref sphere, this, OwnerEntity, false, false, ref m_targetEntities);
             * MyEntities.GetAllIntersectionWithBoundingFrustum(ref m_visualFrustum, m_targetEntities);
             *
             * MyEntity target = null;
             * float closestToMissileDirection = float.MaxValue;
             *
             * foreach (MyEntity entity in m_targetEntities)
             * {
             * if (CanTarget(entity))
             * {
             *  MySmallShip targetShip = entity as MySmallShip;
             *  if (targetShip != null)
             *  {
             *      if ((targetShip.IsEngineTurnedOff()))
             *          continue;
             *  }
             *
             *  Vector3 targetPos = entity.GetPosition();
             *  Vector3 missilePos = this.GetPosition();
             *  Vector3 missilePosEnd = this.GetPosition() + this.WorldMatrix.Forward * 10000;
             *  Vector3 closestPos = MyUtils.GetClosestPointOnLine(ref missilePos, ref missilePosEnd, ref targetPos);
             *
             *  float distance = Vector3.Distance(closestPos, targetPos);
             *
             *  MyDebugDraw.DrawText(targetPos, new System.Text.StringBuilder(distance.ToString()), Color.White, 1);
             *
             *  if (distance < closestToMissileDirection)
             *  {
             *      closestToMissileDirection = distance;
             *      target = entity;
             *  }
             * }
             * }
             *
             * /*
             * MyEntity target = null; //looks better if missile gets "lost"
             *
             * float closestToMissileDirection = float.MaxValue;
             *
             * foreach (MyEntity entity in m_targetEntities)
             * {
             * if (!CanTarget(entity))
             *  continue;
             *
             * if (MyEnemyTargeting.CanSee(this, entity) == null)
             * {
             *  Vector3 targetPos = entity.GetPosition();
             *  Vector3 missilePos = this.GetPosition();
             *  Vector3 missilePosEnd = this.GetPosition() + this.WorldMatrix.Forward * 10000;
             *  Vector3 closestPos = MyUtils.GetClosestPointOnLine(ref missilePos, ref missilePosEnd, ref targetPos);
             *
             *  float distance = Vector3.Distance(closestPos, targetPos);
             *
             *
             *  MyDebugDraw.DrawText(targetPos, new System.Text.StringBuilder(distance.ToString()), Color.White, 1);
             *
             *  if (distance < closestToMissileDirection)
             *  {
             *      closestToMissileDirection = distance;
             *      target = entity;
             *  }
             * }
             * }
             */


            return(base.DebugDraw());

            //MyDebugDraw.DrawBoundingFrustum(m_visualFrustum, Color.White);
            return(true);

            //  bool retVal = base.DebugDraw();
            //if (!retVal)
            //  return false;

            //Matrix tempInvertedWorldMatrix = Matrix.Invert(Body.CollisionSkin.GetPrimitiveLocal(0).Transform.Orientation * Physics.Matrix);

            //  Transform world's Y axis to body space
            //Vector3 forward = MyUtils.GetTransformNormal(WorldMatrix.Forward, ref tempInvertedWorldMatrix);

#if DEBUG_MISSILE
            if (m_targetShip != null)
            {
                //Vector3 torque = MyUtils.GetTransformNormal(MyMwcUtils.Normalize(m_targetEntity.WorldMatrix.Translation - WorldMatrix.Translation), ref tempInvertedWorldMatrix);
                MyDebugDraw.DrawLine3D(WorldMatrix.Translation, WorldMatrix.Translation + (m_targetShip.WorldMatrix.Translation - WorldMatrix.Translation), Color.Pink, Color.Pink);

                MyDebugDraw.DrawLine3D(WorldMatrix.Translation, WorldMatrix.Translation + (m_predicatedPosition - WorldMatrix.Translation), Color.Yellow, Color.Yellow);
            }
#endif
            Vector3 pos = WorldMatrix.Translation;
            MyDebugDraw.DrawSphereWireframe(pos, WorldVolume.Radius, Vector3.One, 1);
            //Matrix matrix = Physics.Matrix;

            /*
             * MyDebugDraw.DrawLine3D(pos, pos + matrix.Right * 1000, Color.Red, Color.Red);
             * MyDebugDraw.DrawLine3D(pos, pos + matrix.Up * 1000, Color.Green, Color.Green);
             * MyDebugDraw.DrawLine3D(pos, pos + matrix.Forward * 1000, Color.Blue, Color.Blue);
             */
            /*
             * pos = WorldMatrix.Translation;
             * matrix = Physics.Matrix;
             * matrix.Right *= m_targetsRelativePosition.X;
             * matrix.Up *= m_targetsRelativePosition.Y;
             * matrix.Forward *= m_targetsRelativePosition.Z;
             *
             * MyDebugDraw.DrawLine3D(pos, pos + matrix.Right * 1000, Color.Red, Color.Red);
             * MyDebugDraw.DrawLine3D(pos, pos + matrix.Up * 1000, Color.Green, Color.Green);
             * MyDebugDraw.DrawLine3D(pos, pos + matrix.Forward * 1000, Color.Blue, Color.Blue);
             */

#if DEBUG_MISSILE
            for (int i = 0; i < m_trailDebug.Count - 1; i++)
            {
                MyDebugDraw.DrawLine3D(m_trailDebug[i], m_trailDebug[i + 1], Color.White, Color.White);
            }
#endif

            //if (this.Physics.CollisionSkin.Collisions.Count > 0)
            //{
            //    MyDebugDraw.DrawLine3D(GetPosition(), GetPosition() + (Vector3.Negate(this.Physics.CollisionSkin.Collisions[0].DirToBody0) * 1000), Color.White, Color.White);
            //}

            return(true);
        }