コード例 #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
ファイル: PolygonTools.cs プロジェクト: yuruyigit/TrueSync
 public static Vertices CreateCircle(FP radius, int numberOfEdges)
 {
     return(PolygonTools.CreateEllipse(radius, radius, numberOfEdges));
 }