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.
Modern video games use physics to achieve realistic behaviour and special effects. Everything from billiard balls, to flying debris, to tactical fighter jets is simulated in games using fundamental principles of dynamics.
Unity comes with dedicated and optimized 2D physics, with many more features and optimizations to power your game. 2D Colliders enable accurate detection of your sprites' shapes, from primitive to custom shapes. If they also include a Rigidbody 2D, the objects will react to gravity and behave as solid objects.
In video game physics, we want to animate objects on screen and give them realistic physical behavior. This is achieved with physics-based procedural animation, which is animation produced by numerical computations applied to the theoretical laws of physics.
Computer animation physics or game physics are laws of physics as they are defined within a simulation or video game, and the programming logic used to implement these laws. Game physics vary greatly in their degree of similarity to real-world physics.
A physics engine is computer software that provides an approximate simulation of certain physical systems, such as rigid body dynamics (including collision detection), soft body dynamics, and fluid dynamics, of use in the domains of computer graphics, video games and film (CGI).
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:
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With