views:

72

answers:

2

I'm very new to game development (iPhone/iPad specifically, if that matters at all) and am having a tough time with working with the physics part of animation. Specifically I'm trying to give several balls (circular UIImageView or CG circles) physical properties (gravity, weight, friction, etc).

Are there any really good tutorials on getting started with physics in game development? The language of the tutorial really doesn't matter as the mechanics of the physical movement really don't change.

+3  A: 

Since you are new to game dev, I would not recommend writing your own physics code if your game is relatively complex. I have two reasons for saying this:

  1. You need to know how to separate physics from game logic, in order to ensure the stability of the physics while maximizing flexibility of game logic.
  2. There are many pitfalls when it comes to designing a physics engine with collision detection, many of which have been solved in existing physics engines.

If you are still set on writing your own physics, I recommend starting by creating a sandbox application with a good existing physics engine. Look at what parts of the physics engine are exposed, and what parts you would like to have exposed. Next, dig into the physics code to see how the objects are updated according to velocity, simulation gravity, mass, friction, etc. See how collision is detected, and how the engine deals with things like tunneling and collision response for extreme cases.

Box2D is well-written open-source physics engine, and is included in Cocos2D. You can create a Box2D game template and jump right into it.

vdeych
+1  A: 

I will give you some links, but, i also have to warn you - implementing physics can be a monster which takes a lot of time and thinking:

An Introduction to Physically Based Modeling
Physically Based Modeling: Principles and Practice

InsertNickHere