0
votes

I'm trying to enact physics on UIKit components, such as UIButtons, and I've decided that using Box2D or Chipmunk will be the easiest way to do this.

However, every single danged tutorial I've found uses them in conjunction with cocos2d, and as a relatively new programmer, I'm finding it really difficult to work out which parts apply to my code (without cocos2d), and which don't.

Anyone know of a good beginners' tutorial for either of these physics engines which my application, in iOS6, can follow? As a new coder, my C/C++ knowledge isn't great either, which doesn't help matters :(

Effectively all I need to do to start with is get a UIKit component (image, button, whatever) moving around with my finger and bouncing off the edges of the screen. If I can have two of them, and have them bounce off each other, all the better.

2

2 Answers

1
votes

We recently made some new example projects. One of them is a color matching game that has variations for Cocos2D and UIkit, both with Chipmunk and Chipmunk Pro variations: https://github.com/slembcke/ChipmunkColorMatch

Haven't quite finished writing the tutorials to go along with all of the variations, but the code is pretty well commented and short.

0
votes

There are two on the Chipmunk website that use UIKit specifically. SimpleObjectiveChipmunk and iPhoneSnap. http://chipmunk-physics.net/documentation.php

Both use the Objective-Chipmunk wrapper, but mostly to take advantage of memory management and fit in a little nicer with UIKit. The C API is similar enough that there wouldn't really be any surprises. There are other C/OpenGL examples on the website as well.