示例#1
0
        public static Fixture AttachEllipse(FP xRadius, FP yRadius, int edges, FP density, Body body, object userData = null)
        {
            if (xRadius <= 0)
            {
                throw new ArgumentOutOfRangeException("xRadius", "X-radius must be more than 0");
            }

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

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

            return(body.CreateFixture(polygonShape, userData));
        }
示例#2
0
 public static Vertices CreateCircle(FP radius, int numberOfEdges)
 {
     return(PolygonTools.CreateEllipse(radius, radius, numberOfEdges));
 }