The physics in HL2: some questions.

Joined
Jun 24, 2004
Messages
1,689
Reaction score
0
Hi, I'm a physics major and naturally I'm interested how they make the physics work in HL2 (and in videogames in general). [I truly fully understand why fluid-dynamics isn't in HL2, cause that thing is a bitch compared to friction, gravity, boyancy).

Ok, can somebody explain or post a link on how they emulate gravity in HL2 (there should be some links), what kind of system they use; ie: instead of composing the barrel of millions of atoms all excerting a force, do they just include a couple of point which are attracted to the ground.

Any help would be appreciated.

PS: I know this is nitpicking, but I'm curious.
 
lazicsavo said:
Hi, I'm a physics major and naturally I'm interested how they make the physics work in HL2 (and in videogames in general). [I truly fully understand why fluid-dynamics isn't in HL2, cause that thing is a bitch compared to friction, gravity, boyancy).

Ok, can somebody explain or post a link on how they emulate gravity in HL2 (there should be some links), what kind of system they use; ie: instead of composing the barrel of millions of atoms all excerting a force, do they just include a couple of point which are attracted to the ground.

Any help would be appreciated.

PS: I know this is nitpicking, but I'm curious.

Lazicsavo, I'm not sure that anyone knows. Perhaps if an entity is given the property of a physics-influenced object, it falls at 9.8 m/sec unless impeded by an opposite force?

I'm interested to know this too. Perhaps you should e-mail someone at Valve and see if you can get an answer!
 
Probably be best to go research Havok and other physics engines.

http://www.havok.com/

But I imagine they probably just treat objects as if all their mass is at their center of gravity. That would work for most things I think.
 
Well, if you have no rotation it's really easy to program (like in HL1), basicly you have a center mass and if there is no ground, down it goes.

But in the new games like HL2 and Far Cry you get all that nice rotation and to calculate using good old pen, paper, and calculator is a bitch (whereas the no rotation can be done really easily). But I will try to write something to Valve asking how they simplified it.
 
Some info here: http://www.euclideanspace.com/physics/rigidBody/simulation/

I don't have time to dig through it right now, but you might be able to find what your looking for there.

I don't think Valve is the best place to ask that type of question. They didn't create the physics engine after all. I'm pretty sure you can find it on the net somewhere.
 
An interesting blurb from this page:

http://www.havok.com/clients/valve.php

... and where else could you put a crowbar in the works to stop a dynamically modeled machine?

Could this be a hint to another possible aspect of gameplay? Using your trusty crowbar to jam some in-game cog causing it to stop?

Can't wait for the game.
 
Keep in mind that although Valve used the Havok engine to base their physics system on, HL2's physics engine is a very heavily modified and spiffed up version of Havok. It's capable of everything Havok allows for and more.
 
And keep in mind that it's HAVOK 1 and not HAVOK 2. :)
 
Yep. But it's probably the equivalent to Havok 2, considering how beefed up from Havok 1 it is.
 
In response to lazicsavo:
I would imagine they do something along the lines of applying a constant downward acceleration on the thing, and maybe a slight dampening effect related to its area in the direction of motion (sim. wind resistance maybe?) Impacts apply force based on mass and velocity, and according to the mass of the thing it hits moves it, etc. Bullets likely have a preset force they apply (I think they said they don't physically model individual bullets, they're just hitscan), and grenades are probably similiar but in a degrading spherical pattern around the initial explosion point.

It will likely be a lot of tricks like that, because absolute physical correctness is really irrelevant so long as it looks right.

And as for jamming up the machine: the crowbar is reportedly physically modeled (a swinging bar in space) so if you have some way to drop it, I guess you could do that. But then you'd be without your prized possession, so I don't know. :(
 
Who needs a crowbar when you can jam the thing with a Combine soldier's corpse! ;)

I would love to see a nice detailed and illistrated explanation of how these physics engines work. It's mildly interesting.
 
Neutrino is most likely right - you just take a centre of gravity and apply a constant weight. I doubt they'd do anything more complicated than that, because you don't need to. What's wrong with it?
 
I would imagine it's a combination of a force applied to the center of gravity and per-polygon hit detection and angular momentem. With a system like that you could achieve essectially any gravity related effect. While the center of mass is pulled down, other parts of the object (verticies) can be slowed or accelerated by outside forces. That would allow for any type of rotation or dampening affects one could imagine.
 
I think it's specifically-shaped physics hulls (Like hit boxes), not per-polygon hit detection. Though, IIRC, they've said that it can use PPHD, but it's more processor-intensive...
 
well, if they had gravity physics on EVERYTHING, then some oddly shaped things would require some work to make them stay standing.
 
Hmm, im a computer science major, and took some classes in computer simulated rigid body mechanics. (That is what physics in HL2 are about) And it was quite straight forward, center of gravity, on which you apply gravity and of an object collides, recalculate the actual force by using a momentum matrix. Basicly calculate the momentum applied on objects center of gravity, thus making the object spin correctly when stuck by an object or a force. The problem is to do this fast. Or shall i say, "was". Nothing fancy. Really. The problem is to tune the variables to make it all look real. Many times when we used "real" values we got som goofy results. But thats because you cant take fluid dynamics into account.
 
I tried to program my own 2D rigid body physics by joining nodes together to create a physically simulated object. I still havn't worked out how to get rotational forces to work, mainly due to a lack of experties in the field of mathmatics.

Anyway this explains how ODE does it http://ode.org/ode-latest-userguide.html#sec_3_2_0

Sounds similiar to what jayte was saying.
 
Back
Top