Disclaimer: I'm actually using Box2DX with C# but there is no forum for that project so I'm posting here and my questions are about Box2D in general.
I have read the (excellent) documentation and still don't understand the following. I realize some of these questions may sound ridiculous but humor me. 🙂
1. Does 1 world pixel = 1 screen pixel? Must I define a scaling factor or is it optional?
2. It's not crystal clear from the Test demo why we need the listeners. I see the comment on MyDestructionListener but even that is not totally clear. Why would a joint be implicitly destroyed? Newbie questions here. 🙂
3. In the Test demo, why is the ground set at position 0.0, -5.0? Wouldn't that make the ground only 5 pixels under the origin?
4. Is the first body added to a world automatically set as the ground body?
5. If a body is added to a world and its position makes it suspended in mid air and no linear velocity is added (via SetLinearVelocity), then will the object automatically fall towards the ground (given gravity exists)?
6. My gravity is set to the following vector: gravity = new Box2DX.Common.Vector2(0.0f, -5.0f);
But the shapes on my screen are "falling" UPWARDS on the screen. Is this possible in the world or is it due to a rendering problem?
7. To translate Windows coordinates (top left is 0,0) to Box2D coordinates (0,0 is at origin), I created this 2 methods that I think should work but they are not.
private float PhysicsXToLocalX(float x)
{
return (float)(this.Width / 2) + x;
}
private float PhysicsYToLocalY(float y)
{
return (float)(this.Height / 2) - y;
}
private float LocalXToPhysicsX(float x)
{
return x - (float)(this.Width / 2);
}
private float LocalYToPhysicsY(float y)
{
return (float)(this.Height / 2) - y;
}
I have read the (excellent) documentation and still don't understand the following. I realize some of these questions may sound ridiculous but humor me. 🙂
1. Does 1 world pixel = 1 screen pixel? Must I define a scaling factor or is it optional?
2. It's not crystal clear from the Test demo why we need the listeners. I see the comment on MyDestructionListener but even that is not totally clear. Why would a joint be implicitly destroyed? Newbie questions here. 🙂
3. In the Test demo, why is the ground set at position 0.0, -5.0? Wouldn't that make the ground only 5 pixels under the origin?
4. Is the first body added to a world automatically set as the ground body?
5. If a body is added to a world and its position makes it suspended in mid air and no linear velocity is added (via SetLinearVelocity), then will the object automatically fall towards the ground (given gravity exists)?
6. My gravity is set to the following vector: gravity = new Box2DX.Common.Vector2(0.0f, -5.0f);
But the shapes on my screen are "falling" UPWARDS on the screen. Is this possible in the world or is it due to a rendering problem?
7. To translate Windows coordinates (top left is 0,0) to Box2D coordinates (0,0 is at origin), I created this 2 methods that I think should work but they are not.
private float PhysicsXToLocalX(float x)
{
return (float)(this.Width / 2) + x;
}
private float PhysicsYToLocalY(float y)
{
return (float)(this.Height / 2) - y;
}
private float LocalXToPhysicsX(float x)
{
return x - (float)(this.Width / 2);
}
private float LocalYToPhysicsY(float y)
{
return (float)(this.Height / 2) - y;
}