Chapter 4. Applying Forces to Bodies

Box2D world is ruled by forces and is able to apply them to bodies to give us a realistic simulation, but if you couldn't manually apply forces to bodies, you won't be able to move bodies, fire bullets, throw birds, drive cars, and do all the awesome things you see when you play physics games.

In this chapter you will learn how to apply forces to move bodies in different ways, managing a lot of new Box2D features including:

  • Applying a force to a body
  • Applying an impulse to a body
  • Setting the linear velocity to a body
  • Knowing the mass of a body
  • Applying the right kind of force according to your gameplay needs
  • Mixing physics with non-physics assets in your game

By the end of the chapter, you will be able to create an ...

Get Box2D for Flash Games now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.