Box2D AddImpulseForce

Hey all,

I’m using ofxBox2d to try to create a simple version of Breakout in openFrameworks (as a means to teach myself how it works).

I’m becoming a bit frustrated with trying to figure out how all of the functions work, as it seems like not everything maps directly from ofxBox2d to Box2d.

I have a ball starting in the center of the screen, and I’d like for it to move in a random direction at a random velocity. So I tried:

balls.back().get()->addImpulseForce(ofVec2f(ofRandom(0,ofGetWidth()), ofGetHeight()), ofVec2f(ofRandom(0,100), ofRandom(0,100)));

But this doesn’t seem to do what I want. In the source, AddImpulseForce takes two ofVec2fs – pt and amt. Does anyone have any experience with this and could tell me how to use this function?