How to restrict paddle movement using Farseer Physics engine 3.2

Posted by brainydexter on Game Development See other posts from Game Development or by brainydexter
Published on 2011-01-27T06:12:29Z Indexed on 2011/01/28 23:39 UTC
Read the original article Hit count: 383

I am new to using Farseer Physics Engine 3.2(FPE), so please bear with my questions. Also, since FPE 3.2 is based on Box2D, I have been reading Box2D manual and pieces of code scattered in samples to better understand terminology and usage.

Pong is usually my testbed whenever I try to do something new. Here is one of the issue I am running into:

  • How can I restrict paddles to move only along Y axis, because the ball comes in and knocks off the paddles and everything floats in space afterwards ? (Box = Rectangle and ball = circle)

  • I know MKS is the unit system, but is there a recommendation for sizes/position to be used ? I know this is a very generic question, but it would be good to know a simple set of values that one could use for making a game as simple as pong.

Between box2d and FPE, I have some doubts:

  • what is the recommended way of making a body in FPE ?

    • world.CreateBody() does not exist in FPE
    • Box2d manual recommends never to "new" body(since Box2D uses Small Object allocators), so is there a recommended way in Farseer to create a body (apart from factories) ?
  • In box2d, it is recommended to keep a track of the body object, since it is also the parent to fixture(s). Why is it that in most of the examples, the fixture object is tracked ? Is there a reason why body is not tracked ?

Thanks

© Game Development or respective owner

Related posts about physics

Related posts about farseer-physics-engine