Take the 2-minute tour ×
Arqade is a question and answer site for passionate videogamers on all platforms. It's 100% free, no registration required.

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?

share|improve this question
1  
This might be a question that's more suitable for GameDev.SE. That being said, I provided an answer since it's a bit of a grey area to me. –  Michael Herold Jul 22 '10 at 14:49
    
The purpose for asking this question is related to this question: gaming.stackexchange.com/questions/3243/… The end result is to know what jumps are possible and what are not in Team Fortress 2. –  Jeffrey Jul 22 '10 at 14:54
    
I would call this on-topic - it only sounds off-topic because you are approaching it from an analytical perspective that most gamers don't. Many of us prefer to get a feel for these things and use a combination of eyeballing and trial-and-error rather than figure out the mechanics like this. But the ultimate goal is the same. –  Grace Note Jul 22 '10 at 15:09

2 Answers 2

up vote 11 down vote accepted

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.

share|improve this answer
3  
Very cunning approach to testing air resistance. –  monorailkitty Jul 23 '10 at 9:47

There is a terminal velocity. Props and actors can only move up to a certain speed in any given direction at a time. This is to help collision detection so props don't get stuck in clipping zones.

The terminal velocity is constant across all Source games, I believe, as it is a non-configurable engine option. It is most noticeable in Portal and Garry's Mod. In Portal, open a portal in the ceiling and one in the floor underneath, creating a loop. You'll quickly hit terminal velocity. In Garry's mod, create a saw blade, crouch on top of it, then grab it with your prop gun and stand up. You'll fly upward at terminal velocity as the prop tries to come toward you.

I don't believe there is any air resistance, as that is very computationally expensive.

Source uses a heavily modified version of the Havok physics engine, so you can look up more information on that.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.