Ejemplo n.º 1
0
        public static Fixture AttachEllipse(float xRadius, float yRadius, int edges, float density, Body body, object userData = null)
        {
            if (xRadius <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(xRadius), "X-radius must be more than 0");
            }

            if (yRadius <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(yRadius), "Y-radius must be more than 0");
            }

            Vertices     ellipseVertices = PolygonUtils.CreateEllipse(xRadius, yRadius, edges);
            PolygonShape polygonShape    = new PolygonShape(ellipseVertices, density);

            return(body.CreateFixture(polygonShape, userData));
        }