JBox2D - Some Newbie Questions

Hi, I just downloaded and got JBox2D working with java and LWJGL today. And have got a basic thing working where i have a box that starts off in the air and falls down onto the ground, where it bounces slightly then stops.

Please can someone help me answer these questions? I think I've forgotten some of them so I might have to ask a few more later. 🙂

1. How can I check when my box has collided with the ground?

2. I can move my box with left and right arrows, and I make it jump by pressing up (although I can't tell if it's on the ground or not when it jumps) . When I press right, I use the following code.

Code:
        if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT))
        {
          //fPosX += 0.001f;
          float fAngularVelocity = m_box.getAngularVelocity();
          fAngularVelocity -= 0.01f;
          m_box.setAngularVelocity(fAngularVelocity);
        }


This kind of works, but some really weird things happen:
a). If I let go when the box is hanging on a corner (eg about to topple left or right), it doesn't when it should. The box does not seem to have any force that pulls it back to the normal position of sitting flat.

/ \
\ /

b). When it is on an angle like this, it bounces REALLY high, much higher than it should. I'm not sure at all why this is.
EDIT: The faster the box is rotating, the higher it bounces. Is it just that im rotating the box too fast?

Why do these things happen? how can I fix them?

Thanks very much,
r_bewick
I fixed my second problem (My box was in radians and I was drawing in degrees) 😳

Can someone help me out with the first? thanks
Have you looked into World.setContactListener()?

Original thread: https://box2d.org/forum/viewtopic.php?t=5804