왜 그런지 모르지만 왜 이것이 작동하지 않는지 알아내는 것 같습니다 ... 저는 화면에서 떨어지는 것과 같은 단순한 것을 만들려고합니다.파르시 물리학 ... 안녕하세요 세계 ...?
사이트의 최신 다운로드 및 첫 번째 예제 코드와 같이 보이지만 여전히 틀 렸습니다.
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Collections;
using Microsoft.Xna.Framework.Input;
using FarseerPhysics.Dynamics;
using FarseerPhysics.Collision.Shapes;
namespace Cross {
public class Game1 : Microsoft.Xna.Framework.Game {
GraphicsDeviceManager graphics;
public Game1() {
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
graphics.IsFullScreen = false;
graphics.PreferredBackBufferHeight = 600;
graphics.PreferredBackBufferWidth = 1200;
this.Window.Title = "Game";
}
protected override void Initialize() {
World world = new World(Vector2.Zero);
Body myBody = world.CreateBody();
myBody.BodyType = BodyType.Dynamic;
CircleShape circleShape = new CircleShape(0.5f);
Fixture fixture = myBody.CreateFixture(circleShape);
base.Initialize();
}
protected override void LoadContent() {
}
protected override void UnloadContent() {
}
protected override void Update(GameTime gameTime) {
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime) {
base.Draw(gameTime);
}
}
}
하지만 2 오류를 얻을 :
내가 이것을 가지고
없음 CreateBody()
방법 (
'FarseerPhysics.Dynamics.World' does not contain a definition for 'CreateBody' and no extension method 'CreateBody' accepting a first argument of type 'FarseerPhysics.Dynamics.World' could be found (are you missing a using directive or an assembly reference?)
CircleShape 생성자는 2 개 인자를 (불구하고 AddBreakableBody()
있다) 이 예제는 쉽지만 여전히 오류가 있습니다.)
'FarseerPhysics.Collision.Shapes.CircleShape' does not contain a constructor that takes 1 arguments
나는 많은 것을 시도해 보았고 나는 이것을 얻을 수있는 이유를 혼란스럽게 생각합니다. 이 코드가 다른 사람들을 위해 작동합니까? 내 dll이 엉망이야?
Ahh'FarseerPhysics.Factories.BodyFactory.CreateBody()'maybe –
XNA Testbed 예제는 http://farseerphysics.codeplex.com/releases/view/64108 특정 방법을 사용하는 방법을 보여주기 때문에 다운로드하는 것이 좋습니다. 소스의 '샘플'섹션을 탐색하여 더 많은 코드 샘플을 얻을 수도 있습니다. http://farseerphysics.codeplex.com/SourceControl/changeset/view/88395 – keyboardP
@keyboardp 감사합니다. 그 두 번째 링크는 나에게 많은 도움이되는 약간의 자료를 주었다. –