
#PROJECTILE INTERSECTION VECTOR 2D FULL#
Using a physics engine can cause some unnecessary overhead when its full function isn't required. In some games, using a predefined engine isn't necessarily the optimal choice.

Another popular choice is Chipmunk 2D, which is used in several mainstream game engines, like Cocos2D. One of the most popular choices for 2D games is Box2D it's a native C++ written engine, but has wrappers, ports, and extensions that allow it to be used in nearly any 2D platform. Several excellent options exist for predefined and ready-to-use physics engines. When you first start to think about using physics in your game, you will need to decide how you want to approach the problem, and what your game will require in terms of simulation. We'll look at how physics engines work shortly, but first lets look at what engines you may want to use, and why you may decide to use them, based on your particular needs. Forces affect in-game actions and the movement of objects, characters, and even the world-space itself. But forces aren't limited to contact other forces, such as gravity and impulses, can occur, without objects actually touching. This is all handled behind the scenes, using the calculated forces of the engine. Collision detection using a physics engine allows for very precise contact listening, and allow interactions between objects to be simulated using forces.įorce simulation: After a collision, what should happen? Game logic could be called, you could bounce, the other game object could bounce, or you could simply move no further.


Why use a physics engine? What does it actually do?Ī physics engine helps us do two very important things for our game: We'll look at the basics of using 2D physics in game world space, such as creating bodies and applying impulses and forces. In this article, we'll examine the use of physics to simulate projectile effects in games like Angry Birds.
