开发者

Resources for algorithms for creating kinetic movement

开发者 https://www.devze.com 2023-01-29 22:58 出处:网络
I\'m playing with ideas for a iPhone app which would require me to recreate the movement of objects in the real world, as objects in 2D. A lot of games do this sort of thing. My math skills are a litt

I'm playing with ideas for a iPhone app which would require me to recreate the movement of objects in the real world, as objects in 2D. A lot of games do this sort of thing. My math skills are a little weak in this area so I'm looking for some开发者_如何学运维 resource (websites) recommendations on coding techniques to recreate these things. The two I'm looking to start with are gears and levers.

So for example, if I want to work out the position of a second gear based on the movement of a first, whats an efficient method to do this. Note I say efficient, I'm not concerned if the algorithm uses some cheat to bypass a lot of geometry or physics math. The target is to as quickly as possible calculate the end result so I can draw it on screen.

Any suggestions?


What you probably want is Chipmunk Physics

http://wiki.slembcke.net/main/published/Chipmunk

which is used in 10s of thousands of iPhone games and is pretty much "the" physics engine of the ifone phenomenon. There is also Box2D which is similar.

They are dead easy to use, a child can do it.

A lot of people like Cocos2D (I just personally do not like it, but I'm grumpy) which is an "all in one" 2d thingy, which indeed includes those physics libraries.

Conversely you can go crazy with Unity3D, which lets you directly access the Raw Physics Power of the nvidia chips, love the metal.

Just for the record (you may know this) there are some 100s (1000s?) of "gear" games for the iFone/Pad (I believe one of the huge sellers is called something like "Gears" or "Gears for the iPhone" or "Gears HD").

It may get you going to look at some of the state of the art.

It is worth noting that in some situations when you do "physics" for gears, you don't actually use "physics" (in the hard sense of what chipmunk physics does), you do nothing more exciting than keep the angular position of the gear in "a variable", and just map those to the other touching gears with a line of code.

A final note - you might also just try Corona SDK (google) which is one of those "utterly trivial, you don't have to be a programmer" thingies for making iFone apps. In fact it completely includes chipmunk physics (or box2d, I forget) with no effort on your part. (Look at the demos on their page.)

Finally for the record this is a critical paper on spatial tabling! (8 yrs old now) http://graphics.ethz.ch/Downloads/Publications/Papers/2003/Tes03/Tes03.pdf

Hope it helps


Your tag says Objective C, but there are several JavaScript libraries for 2D physics, Box2D among them, that you might find useful.

0

精彩评论

暂无评论...
验证码 换一张
取 消