# What units does Sprite Kit use for physics?

I'm developing a simple ball game in Sprite Kit. I need to predict the ball's trajectory, so I went back to my physics book for the equations for acceleration, time, speed and space.

The problem is that Sprite Kit documentation does not declare the units of measurement of the properties of physics bodies, so it's hard to calculate the needed values.

Based on my experiments/research I suppose that:

• gravity is expressed in m/s/s (m/s^2)
• since gravity is a CGVector, all CGVectors are expressed in m/s/s (m/s^2)
• velocity (instant speed) is m/s

Then I realized a simple scene where a ball is falling:

• Gravity: CGVector(0,1.2);
• Height: 218.009499 pixels
• Time: 0.302499747
• Then acceleration should be: 2*Height / Time^2 = 1441.3863 pixels/s/s
• And gravity of 1.2m/s/s corresponds to 1441.3863 in a world measured in pixels

Someone says the internal PTM (pixel to meter ratio) is 150.

Any hints?

• I made other experiments and I think the correct PTM Ratio is 173.3471 – Lorenzo Iannone Mar 24 '14 at 17:39

## 1 Answer

They actually do specify it:

All values in Sprite Kit are specified using the International System of Units (SI units).

Gravity and velocity are both meters per second. (Though gravity ought to be meters per second squared; that might be a typo.)

When adding velocity to your sprite, ensure you use the the appropriate method, for instance ApplyForce versus ApplyImpulse: ApplyImpulse affects the body’s linear velocity without changing its angular velocity. ApplyForce accelerates the body without imparting any angular acceleration to it. The acceleration is applied for a single simulation step (one frame).

Also, do not rely on pixels; use points if you need precision, as Retina and non-Retina displays have different amounts of pixels per square inch.