I'm developing an air hockey game for iOS based on UIKit and Box2D. I managed to model the world (table limits, puck and handles), and move the handles around their respective play areas, however, I'm still unable to cause the puck (ball) to move around the table when I hit it with the handle (it simply gets displaced a little). I guess this is because the mallet does not have a velocity vector, I'm simply setting its position every time its touchesMoved method gets called.
Code:
CGFloat Xm = px2m(pos.x);
CGFloat Ym = px2m(480.0 - pos.y);
malletBody->SetTransform(b2Vec2(Xm, Ym), 0);
I'm a complete Box2D newbie so I'll appreciate any pointer you can give me about how I can get the expected result.
Sorry for my broken English!
edit: (px2m is a function that translates pixel coordinates to Box2D coordinate system).