c# - Cannot implicitly convert type 'System.Collections.Generic.List' to 'FarseerPhysics.Dynamics.Fixture' -
i error message in line when seek attach fixture body.
fixture newfixture = fixturefactory.attachcompoundpolygon(list, 1.0f, testbody);
cannot implicitly convert type 'system.collections.generic.list' 'farseerphysics.dynamics.fixture'
how can create fixture , attach body? possible attach more 1 fixture body?
the rest of code:
list<vertices> list = new list<vertices>(); vector2 _origin; float _scale; uint[] info = new uint[sprite.width * sprite.height]; sprite.getdata(data); vertices texturevertices = polygontools.createpolygon(data, sprite.width, false); vector2 centroid = -texturevertices.getcentroid(); texturevertices.translate(ref centroid); _origin = -centroid; texturevertices = simplifytools.reducebydistance(texturevertices, 4f); list = triangulate.convexpartition(texturevertices, triangulationalgorithm.bayazit); _scale = 1f; vector2 vertscale = new vector2(convertunits.tosimunits(1)) * _scale; foreach (vertices vertices in list) { vertices.scale(ref vertscale); }
fixture newfixture = fixturefactory.attachcompoundpolygon(list, 1.0f, testbody);
this line of code returns list<fixture>
here method signature fixturefactory source code.
public static list<fixture> attachcompoundpolygon(list<vertices> list, float density, body body)
so you're getting list<fixture>
back. if want first item in list (which might case, since you're assuming there'd one),
fixture newfixture = fixturefactory.attachcompoundpolygon(list, 1.0f, testbody).first();
c# farseer
No comments:
Post a Comment