The gravity model in Source engine games

pcsource-engine

How is gravity modeled in the Source engine? Does it use a standard acceleration model of units per second squared? Is there a terminal velocity? Does air resistance play a role? For whatever this model is, are the constants the same for all games, or does it vary from title to title?

Best Answer

At least in Portal, there is no air resistance, though whether this is due to the engine or the game design itself, I'm not sure.

It's easy to test -- simply place two portals on the floor, and fall directly down onto one. If done correctly, Chell will continuously fall through the one portal, exit through the second, reach the apex, fall back through the portal, and repeat ad infinitum. No matter how many passes through the portal, each time she will rise to the same level -- i.e. no air resistance.

Likewise, it is very easy to test for a terminal velocity (given that we know there is no air resistance) -- again, in Portal, play through the last level until just before GlaD0s. There is a large wire bridge very high above a room (it is the one with 12+ sentry robots placed at various nooks and crannies around the room). Shooting two portals into the floor (as described above) and jumping into them will show that though velocity is maintained through the portals, there is not nearly enough momentum to reach the bridge again -- hence, the previously established terminal velocity.

Since a mod exists to add the portal gun to Team Fortress 2... (http://www.3-pg.com/forums/index.php?showtopic=5292) it stands to reason that either a) these factors as they relate to gravity calculations are equivalent between the two source games, or b) you can test for yourself (via custom maps, if necessary) by using the portal gun in team fortress 2 (which I know is the game that garnered these questions in the first place)

Edit: On second thought, I'm not sure the portal gun from the mod uses the same code as the one from Portal, so test that with a grain of salt.