Hello,
I am a newbie at using Box2D, and I am currently working on a project with Visual CSharp . I would like to use the C# port of Box2D, and I have been trying to make it in the following way :
- Create a new winform program
- Add a reference to the Box2DX.dll file
- Add the following code, adaptated from the samples in C++ I found in the Box2D website :
Box2DX.Collision.AABB worldAABB = new Box2DX.Collision.AABB();
worldAABB.LowerBound.Set(100.0f, 100.0f);
worldAABB.UpperBound.Set(100.0f, 100.0f);
Box2DX.Common.Vec2 gravity= new Box2DX.Common.Vec2(0.0f, -10.0f);
bool doSleep = true;
Box2DX.Dynamics.World world = new Box2DX.Dynamics.World(worldAABB, gravity, doSleep);
Box2DX.Dynamics.BodyDef groundBodyDef = new Box2DX.Dynamics.BodyDef();
groundBodyDef.Position.Set(0.0f, -10.0f);
Box2DX.Dynamics.Body groundBody =world.CreateBody(groundBodyDef);
groundBody.ToString();
Box2DX.Collision.PolygonDef groundShapeDef = new Box2DX.Collision.PolygonDef();
groundShapeDef.SetAsBox(50.0f, 10.0f);
Box2DX.Collision.Shape s = groundBody.CreateShape((Box2DX.Collision.ShapeDef)groundShapeDef);
Everything works well until the last line. When the last line is executed, I get an ASSERT(boolean condition) message from
Box2DXDebug. Unfortunately, I was unable to understand where the problem comes from. Can somedy help me ?
Another point is about finding the source code of Box2DX. Is it available somewhere, and can I download it ?
Thank you in advance for any help or advice.
I am a newbie at using Box2D, and I am currently working on a project with Visual CSharp . I would like to use the C# port of Box2D, and I have been trying to make it in the following way :
- Create a new winform program
- Add a reference to the Box2DX.dll file
- Add the following code, adaptated from the samples in C++ I found in the Box2D website :
Box2DX.Collision.AABB worldAABB = new Box2DX.Collision.AABB();
worldAABB.LowerBound.Set(100.0f, 100.0f);
worldAABB.UpperBound.Set(100.0f, 100.0f);
Box2DX.Common.Vec2 gravity= new Box2DX.Common.Vec2(0.0f, -10.0f);
bool doSleep = true;
Box2DX.Dynamics.World world = new Box2DX.Dynamics.World(worldAABB, gravity, doSleep);
Box2DX.Dynamics.BodyDef groundBodyDef = new Box2DX.Dynamics.BodyDef();
groundBodyDef.Position.Set(0.0f, -10.0f);
Box2DX.Dynamics.Body groundBody =world.CreateBody(groundBodyDef);
groundBody.ToString();
Box2DX.Collision.PolygonDef groundShapeDef = new Box2DX.Collision.PolygonDef();
groundShapeDef.SetAsBox(50.0f, 10.0f);
Box2DX.Collision.Shape s = groundBody.CreateShape((Box2DX.Collision.ShapeDef)groundShapeDef);
Everything works well until the last line. When the last line is executed, I get an ASSERT(boolean condition) message from
Box2DXDebug. Unfortunately, I was unable to understand where the problem comes from. Can somedy help me ?
Another point is about finding the source code of Box2DX. Is it available somewhere, and can I download it ?
Thank you in advance for any help or advice.