Example #1
0
        public override void DebugRender(Batcher batcher)
        {
            var poly = Shape as Polygon;

            batcher.DrawHollowRect(Bounds, ECDebug.Colors.ColliderBounds, ECDebug.Size.LineSizeMultiplier);
            batcher.DrawPolygon(Shape.position, poly.Points, ECDebug.Colors.ColliderEdge, true,
                                ECDebug.Size.LineSizeMultiplier);
            batcher.DrawPixel(Entity.Transform.Position, ECDebug.Colors.ColliderPosition,
                              4 * ECDebug.Size.LineSizeMultiplier);
            batcher.DrawPixel(Shape.position, ECDebug.Colors.ColliderCenter, 2 * ECDebug.Size.LineSizeMultiplier);

            // Normal debug code
            //for( var i = 0; i < poly.points.Length; i++ )
            //{
            //	Vector2 p2;
            //	var p1 = poly.points[i];
            //	if( i + 1 >= poly.points.Length )
            //		p2 = poly.points[0];
            //	else
            //		p2 = poly.points[i + 1];
            //	var perp = Vector2Ext.perpendicular( ref p1, ref p2 );
            //	Vector2Ext.normalize( ref perp );
            //	var mp = Vector2.Lerp( p1, p2, 0.5f ) + poly.position;
            //	batcher.drawLine( mp, mp + perp * 10, Color.White );
            //}
        }