0
當我想要在Farseer中創建多邊形時,總是會收到很多錯誤消息。如何在Farseer中創建多邊形?
「FarseerPhysics.Common.Vertices」不包含一個定義 'CreatePolygon「FarseerPhysics.Factories.BodyFactory」不 包含定義「實例」名稱「physicsSimulator」不 不存在當前上下文「triangleGeomtry」名稱不 在目前情況下該名稱存在「GeomFactory」在 不存在當前上下文名稱「physicsSimulator」不在 當前上下文
什麼是存在的錯誤? 如何在Farseer中創建多邊形?
triangleSprite = Content.Load<Texture2D>("triangle"); // Load the Sprite
data = new uint[triangleSprite.Width * triangleSprite.Height];
triangleSprite.GetData(data);
verts = Vertices.CreatePolygon(data, triangleSprite.Width, triangleSprite.Height);
polygonOrigin = verts.GetCentroid();
triangleBody = BodyFactory.Instance.CreatePolygonBody(physicsSimulator, verts, 3);
triangleBody.Position = new Vector2(400, 600);
triangleGeomtry = GeomFactory.Instance.CreatePolygonGeom(physicsSimulator, triangleBody, verts, 0);
什麼是physicsSimulator和triangleGeometry?你需要先定義它們 – Cyral