Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There are two physics engines in iOS 7.

SpriteKit - Contains a 2D physics engine similar to Box 2D but not as full featured (joints, rigid bodies, shapes, polygons). The whole engine is similar to Cocos2D but ships with iOS 7. A particle editor and texture atlas generator is now built-in to Xcode because of it.

UI Dynamics - Contains a set of constraints and joints which can be used to flip and throw views around the screen. Lots of API hooks for responding to / taking user interaction into account. This is used for effects like when you scroll the messages list (the message bubbles bounce and collide) or when you drop notification center down (it bounces).

Edit: from a brief look at the source code, this example uses the UIDynamicAnimator API, so it is simulated entirely with the UI dynamics stuff.



SpriteKit itself isn't a physics engine, it comes with one Also, the Physics Engine isn't 'similar' to Box 2D - it _IS_ Box 2D with an OBJ-C wrapper.

Same thing applies to UIKit Dynamics, except it plays along with UIKit stuff.


Yes, that's what I meant when I said SpriteKit contains an engine similar to Box 2D. I thought my comment was reasonably clear about SpriteKit not just being the physics engine.

According to my tests it is not Box 2D, it produces significantly different results and only implements a subset of functionality. I've been told by others with more experience that it isn't Box 2D also, but if you have more information I'd like to know for sure.


The SpriteKit physics engine uses Box2D internally. Here is a dump of the SpriteKit framework:

https://ghostbin.com/paste/tm4ko

b2* shows up in there many times.

edit: slow pony


Thanks for that, that's really interesting. It behaved differently in my experiments so I assumed it wasn't the same — but it must just be a different configuration.


If you look at this dump, you can see references to b2World, b2Body etc, https://ghostbin.com/paste/tm4ko


This is correct. It's all UIDynamicsAnimators using Pushes, Collisions, and Gravity.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: