Just starting to hook up my small game project with box2D; I seem to be stuck at hello world, however...
What I want is to be able to apply angular impulse to a body resting on the ground and have it rotate like a crate on a cement floor.
What I have made so far are simulations in which the body (with a square fixture):
a) Has a surreal angular inertia to mass ratio and jumps into the air when I apply an angular impulse (and doesn't rotate at all when resting on the ground at an angle).
I set the body's mass data to something less absurd.
b) Does not jump into the air, but seems to dig its corner into the floor and gains velocity to the left when it's turning *clockwise*.
I thought this could have something to do with the distance scale I'm using (I had set a sane default where the fixture had sides with 0.4 meters in length and the floor was 16 meters wide, but at this point I felt my sanity escaping me), so I played with it, and reached two new situations:
c) Falls through the floor.
e) Has a surreal angular inertia to mass ration and jumps into the air when I apply an angular impulse. (See 'a'.)
I swear, I'm not always this bad at getting things working. What could I be doing wrong?
Source: https://github.com/solemnsky/solemnsky/blob/master/src/demo/physdemo.cpp https://github.com/solemnsky/solemnsky/blob/master/src/sky/physics.cpp
What I want is to be able to apply angular impulse to a body resting on the ground and have it rotate like a crate on a cement floor.
What I have made so far are simulations in which the body (with a square fixture):
a) Has a surreal angular inertia to mass ratio and jumps into the air when I apply an angular impulse (and doesn't rotate at all when resting on the ground at an angle).
I set the body's mass data to something less absurd.
b) Does not jump into the air, but seems to dig its corner into the floor and gains velocity to the left when it's turning *clockwise*.
I thought this could have something to do with the distance scale I'm using (I had set a sane default where the fixture had sides with 0.4 meters in length and the floor was 16 meters wide, but at this point I felt my sanity escaping me), so I played with it, and reached two new situations:
c) Falls through the floor.
e) Has a surreal angular inertia to mass ration and jumps into the air when I apply an angular impulse. (See 'a'.)
I swear, I'm not always this bad at getting things working. What could I be doing wrong?
Source: https://github.com/solemnsky/solemnsky/blob/master/src/demo/physdemo.cpp https://github.com/solemnsky/solemnsky/blob/master/src/sky/physics.cpp