public FSCollisionEllipse setRadii(float xRadius, float yRadius) { _xRadius = xRadius; _yRadius = yRadius; _verts = PolygonTools.createEllipse(_xRadius * FSConvert.displayToSim, _yRadius * FSConvert.displayToSim, _edgeCount); recreateFixture(); return(this); }
public FSCollisionEllipse setEdgeCount(int edgeCount) { Assert.isFalse(edgeCount > Settings.maxPolygonVertices, "edgeCount must be less than Settings.maxPolygonVertices"); _edgeCount = edgeCount; _verts = PolygonTools.createEllipse(_xRadius * FSConvert.displayToSim, _yRadius * FSConvert.displayToSim, _edgeCount); recreateFixture(); return(this); }
public FSCollisionEllipse(float xRadius, float yRadius, int edgeCount) { Assert.isFalse(edgeCount > Settings.maxPolygonVertices, "edgeCount must be less than Settings.maxPolygonVertices"); _xRadius = xRadius; _yRadius = yRadius; _edgeCount = edgeCount; _verts = PolygonTools.createEllipse(_xRadius * FSConvert.displayToSim, _yRadius * FSConvert.displayToSim, _edgeCount); }
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"); } var ellipseVertices = PolygonTools.createEllipse(xRadius, yRadius, edges); var polygonShape = new PolygonShape(ellipseVertices, density); return(body.createFixture(polygonShape, userData)); }