我使用 Farseer Physics Engine 进行泵模拟。在那里的例子中,他们总是使用 texture2d 格式。但是该泵形状仅给出了 Point(x,y) 数组。
我想从那个点数组制作多边形或纹理2d。
PolygonTools.CreatePolygon 方法需要 int[] 和 width,而不是 point[]。
我不知道如何通过 int[] 和宽度制作多边形。
请帮忙。
我试过这种方式来解决上述问题。
Common.Vertices testVertices = new Common.Vertices(testVector);
testBody = BodyFactory.CreatePolygon(World, testVertices, 1f);
testBody.BodyType = BodyType.Dynamic;
SetUserAgent(testBody, 100f, 100f);
testSprite = new Sprite(ScreenManager.Assets.TextureFromVertices(testVertices, MaterialType.Squares, Color.YellowGreen, 1f));
_polygonTexture = testSprite.Texture;
testVector 是我的点数组。我通过这种方式从点数组中获得了纹理。
但是... BodyFactory.CreatePolygon 方法只支持 8 个顶点。我的积分超过 8. 10000 或 100000. over..
我想从我的观点[]中找到另一种制作 Texture2D 的方法。
或..修改上述代码以应用超过 8 分..请。
我非常感谢您的帮助。
谢谢你。