Skip to content

Instantly share code, notes, and snippets.

@jaburns
Last active August 29, 2015 14:14
Show Gist options
  • Save jaburns/221b86baf4e78454493a to your computer and use it in GitHub Desktop.
Save jaburns/221b86baf4e78454493a to your computer and use it in GitHub Desktop.
Game "physics" constants conversion rules

Game "physics" constants conversion rules

Converting from dt=A to dt=B

Per-frame scale values (i.e. vx *= Z)
Z_new = Z ^ (B/A)
Acceleration values (i.e. vx += Z)
Z_new = Z * (B/A)^2
Velocity values (i.e. vx = Z or x += Z)
Z_new = Z * (B/A)

Converting from distance_unit=A to distance_unit=B

Distance scaling is much simpler.

Per-frame scale values (i.e. vx *= Z)
Z_new = Z
Acceleration values (i.e. vx += Z)
Z_new = Z * (B/A)
Velocity values (i.e. vx = Z or x += Z)
Z_new = Z * (B/A)
Position values (i.e. x = Z)
Z_new = Z * (B/A)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment