Farseer: Difficulties with implementation of DebugView
I added the project "Farseer Physics Engine 3.3.1 HelloWorld XNA\DebugView XNA\DebugView XNA.csproj" to my solution explorer in Visual Studio. In addition, I added a reference to my project and the "using FarseerPhysics.DebugViews;" to my class.
But DebugView is still not working. I tried this code but I always get an error message and a warning. I found the code in a Farseer discussion: https://farseerphysics.codeplex.com/discussions/275582
Error message:
'FarseerPhysics.DebugViews.DebugViewXNA' does not contain a definition for 'DebugPanel' and no extension method 'DebugPanel' accepting a first argument of type 'FarseerPhysics.DebugViews.DebugViewXNA' could be found (are you missing a using directive or an assembly reference?)
Warning:
The referenced component 'DebugView XNA Content (Content)' could not be found.
What is this DebugPanel? What is wrong?
What should I change in my code?
Code:
World world;
DebugViewXNA physicsDebug;
DebugViewXNA DebugViewFlags;
physicsDebug = new DebugViewXNA(world);
physicsDebug.AppendFlags(DebugViewFlags.DebugPanel);
physicsDebug.DefaultShapeColor = Color.White;
physicsDebug.SleepingShapeColor = Color.LightGray;
physicsDebug.LoadContent(GraphicsDevice, Content);
Drawing DebugView:
// calculate the projection and view adjustments for the debug view
Matrix projection = Matrix.CreateOrthographicOffCenter(0f, graphics.GraphicsDevice.Viewport.Width / _displayUnitsToSimUnitsRatio,
graphics.GraphicsDevice.Viewport.Height / _displayUnitsToSimUnitsRatio, 0f, 0f,
1f);
Matrix view = Matrix.CreateTranslation(new Vector3((_cameraPosition / _displayUnitsToSimUnitsRatio) - (_screenCenter / _displayUnitsToSimUnitsRatio), 0f)) * Matrix.CreateTranslation(new Vector3((_screenCenter / _displayUnitsToSimUnitsRatio), 0f));
// draw the debug view
physicsDebug.RenderDebugData(ref projection, ref view);
I added the project "Farseer Physics Engine 3.3.1 HelloWorld XNA\DebugView XNA\DebugView XNA.csproj" to my solution explorer in Visual Studio. In addition, I added a reference to my project and the "using FarseerPhysics.DebugViews;" to my class.
But DebugView is still not working. I tried this code but I always get an error message and a warning. I found the code in a Farseer discussion: https://farseerphysics.codeplex.com/discussions/275582
Error message:
'FarseerPhysics.DebugViews.DebugViewXNA' does not contain a definition for 'DebugPanel' and no extension method 'DebugPanel' accepting a first argument of type 'FarseerPhysics.DebugViews.DebugViewXNA' could be found (are you missing a using directive or an assembly reference?)
Warning:
The referenced component 'DebugView XNA Content (Content)' could not be found.
What is this DebugPanel? What is wrong?
What should I change in my code?
Code:
World world;
DebugViewXNA physicsDebug;
DebugViewXNA DebugViewFlags;
physicsDebug = new DebugViewXNA(world);
physicsDebug.AppendFlags(DebugViewFlags.DebugPanel);
physicsDebug.DefaultShapeColor = Color.White;
physicsDebug.SleepingShapeColor = Color.LightGray;
physicsDebug.LoadContent(GraphicsDevice, Content);
Drawing DebugView:
// calculate the projection and view adjustments for the debug view
Matrix projection = Matrix.CreateOrthographicOffCenter(0f, graphics.GraphicsDevice.Viewport.Width / _displayUnitsToSimUnitsRatio,
graphics.GraphicsDevice.Viewport.Height / _displayUnitsToSimUnitsRatio, 0f, 0f,
1f);
Matrix view = Matrix.CreateTranslation(new Vector3((_cameraPosition / _displayUnitsToSimUnitsRatio) - (_screenCenter / _displayUnitsToSimUnitsRatio), 0f)) * Matrix.CreateTranslation(new Vector3((_screenCenter / _displayUnitsToSimUnitsRatio), 0f));
// draw the debug view
physicsDebug.RenderDebugData(ref projection, ref view);
No comments:
Post a Comment