The unit of Universe

This is derivative from Reddit post I started. 

Godot’s Physics2D engine operates on internal, pixel-based units. ΔV needs the data in real-world units, so I need to translate one to another.

Why?

I want the physics of the game to be relatable. Todays spacecraft use kN for thrust and m \over s^2 for acceleration, and I want ΔV to use the same, so the player who ever saw an actual space launch can relate the values.

How?

This is the fun part. First, I need to now in what units internally Physics2D engine operates. I found no information on the subject in docs, so i resolved myself to educated guesses:

  • Distance is in pixels
  • Mass is in whatever you enter (assuming gmu as Godot Mass Unit)
  • Weight seems currently broken
  • Velocity is in pixels per second

The translation.

First, my assumptions. My mass unit is 1000kg and my pixel is 10cm wide. That should allow all the necessary conversions from Godot units to real ones:

  • The distance is conveniently 1[m] = 10[px] and 1[px] = 0.1[m].
  • Mass is assumed 1000[kg] = 1[gmu].
  • Linear velocity: 1 [{ px \over s}] = 0.1 [{ m \over s }].
  • Force is 1 [{ gmu * px \over s^2 }] = [{ 1000kg * 0.1m \over s^2  }] = 100 [{ kg * m \over s^2 }] = 100[N] .
  • Impulse is the momentum:  1 [{ gmu * px \over s }] = [{ 1000kg * 0.1m \over s }] = 100 [kg * { m \over s }].
  • Kinetic energy can be derived from mass and velocity as E_k ={{ m * v^2 } \over 2 }  [ gmu * ({ px \over s })^2] = [{ 1000kg * 0.01m^2 \over s^2 }] = [10 { kg * m^2 \over s^2 }] = 10[J]

That’s about all the units I need now – I can translate real thrust to impulse applied and compute impact energy in J (more likely – GJ). Armed with this data we can resume modeling out our game in real units.

Leave a Reply