So how does one monkey with Gravity?

  • Thread starter Thread starter painboi
  • Start date Start date
P

painboi

Guest
I know you can't do 0 gravity but I have been in some CS games where the admin decided to drop the gravity. He probably used a console command. But is there anyway to set it as a default? How does one go about this? Is there a "global setting"? In some of the entity lists I have paged through it talked about a "trigger_gravity" entity but I can't seem to find it. Is this something that has to be coded. Any help would be appreciated.
 
In game, gravity is controlled by the cvar sv_gravity. Its default value is 600, and changing it affects everything that's affected by gravity. So if you find out where that cvar is read/written in the code, that should lead you to the answer.

If you want to set it as the default value in a (listen) server, create listenserver.cfg in half-life 2 deathmatch/hl2mp/cfg, and insert a line like sv_gravity 100.

EDIT: While we're on the topic, has anyone done any research into supporting nonvertical gravity? The problem isn't simple at all, but to have levels shaped like Halo (where you could walk all around the outside, and fire at enemies above you) would be very cool.
 
Yes, nonvertical gravity would be very interesting and open many posibilities.
 
Set gravity to the lowest possible level, create a map that rotates at a certain speed and let centripetal force take care of the rest? Probably won't be that simple, but what the hey, Havok seems pretty smart.

Physicles said:
In game, gravity is controlled by the cvar sv_gravity. Its default value is 600, and changing it affects everything that's affected by gravity. So if you find out where that cvar is read/written in the code, that should lead you to the answer.

If you want to set it as the default value in a (listen) server, create listenserver.cfg in half-life 2 deathmatch/hl2mp/cfg, and insert a line like sv_gravity 100.

EDIT: While we're on the topic, has anyone done any research into supporting nonvertical gravity? The problem isn't simple at all, but to have levels shaped like Halo (where you could walk all around the outside, and fire at enemies above you) would be very cool.
 
Jonsi said:
Set gravity to the lowest possible level, create a map that rotates at a certain speed and let centripetal force take care of the rest? Probably won't be that simple, but what the hey, Havok seems pretty smart.

Good idea; after all, that's what Halo uses to create its gravity. But it's not the best for performance (nothing could ever be removed from the simulation).

There's also the problem of reorienting the player based on which direction is "up" (and calculating up is nontrivial). I have a feeling this will get dicey when you talk about rotating the collision hulls and getting Havok to let you walk on an arbitrarily angled surface.

Further, Havok doesn't seem to do to well when you're walking on a physically simulated object. For instance, you can actually push yourself on the merry-go-round. This may or may not have to be fixed for the arbitrary gravity thing.

Gravity as a vector field is the most general -- in addition to Halo, you could create a sphere, or a box that the player walks around -- all in the same map.

It's on my to-do list.
 
Thanks for the info all.

I was able to reset the gravity to .0001. It is so low you might as well be in 0 grav. On the fall of the jump the descent is almost imperceptible. At least for a while. It does seem to pick up velocity the closer you get to the floor. Just enough to be perceptible. Note: when you jump you will be plastered to the ceiling for a number of minutes as you continue to "rise." However nothing else seemed to be affected by the grav change. Not objects (oil drums, tables, and such) or grenades. They all reacted as if they had normal grav. Is this something that needs to be changed with each object? They are obviously affected by some kind of force.

As far as the non-vertical gravity goes would it be possible to create a brush that lays over a surface that allows you to "stick" to it. Kind of like "magnetic" boots or spidey powers?

Edit: BTW does anybody know of a list of console commands and what they do?
 
Physicles said:
Good idea; after all, that's what Halo uses to create its gravity. But it's not the best for performance (nothing could ever be removed from the simulation).

There's also the problem of reorienting the player based on which direction is "up" (and calculating up is nontrivial). I have a feeling this will get dicey when you talk about rotating the collision hulls and getting Havok to let you walk on an arbitrarily angled surface.

Further, Havok doesn't seem to do to well when you're walking on a physically simulated object. For instance, you can actually push yourself on the merry-go-round. This may or may not have to be fixed for the arbitrary gravity thing.

Gravity as a vector field is the most general -- in addition to Halo, you could create a sphere, or a box that the player walks around -- all in the same map.

It's on my to-do list.

Yeah I figured it wasn't gonna be that easy. I tried jumping on a stack of crates one time and it felt like I was doing the funky chicken. I'm curious as to whether Havok is expecting a singular vector representing gravity, or a vector field...

Edit: BTW does anybody know of a list of console commands and what they do?

Hit the HL2World Wiki database. It's good stuff. ;)
 
Note that in CS:Source (and HL1 mods) default gravity is 800.

Also, a weird bug that seems to happen in our CSS server is that objects seem to use the previous map's gravity settings. For instance, if we play dust2 with 200 gravity, then change the map to de_aztec, our server's gravity is 800 again, but guns will float as if there was 200 gravity.
 
Would it really be that hard to do? Couldn't it be done in about the same way the Natural Selection team did for the Skulk?
 
DreadLord1337 said:
Note that in CS:Source (and HL1 mods) default gravity is 800.

Also, a weird bug that seems to happen in our CSS server is that objects seem to use the previous map's gravity settings. For instance, if we play dust2 with 200 gravity, then change the map to de_aztec, our server's gravity is 800 again, but guns will float as if there was 200 gravity.

thanks! i was wondering how they do it.
 
Um...How did they do it for Skulk? And for that matter what is skulk?
 
I really don't think it would be possible to make a map where you can walk on the inside of a ring for example. The trouble is, in HL2 unless you're in a vehicle it won't change your view perspective. So you ALWAYS jump UP according to the map's up. It might be possible to do a SP map where the ring rotates around you, but in multiplayer games i'm pretty sure it's impossible.

This is really annoying because i've always wanted to make an Enders Game team-deathmatch map. You know, when they're in the giant cube shooting laser guns at each other in zero g? Anyways, i tried it with HL1 and it really turned out quite crappy. I had to cover everything with the ladder entity to allow people to "jump" sideways off the walls, but you couldn't do any angles or anything.

Might be able to make a mod of it though... If anybody does make a mod or makes a map that works i'll be VERY interested. (It someone does, e-mail me at [email protected])

-DaMaN
 
Dragoon said:
Would it really be that hard to do? Couldn't it be done in about the same way the Natural Selection team did for the Skulk?
Hmmm, good point... so it CAN be done with a reasonable amount of effort. Of course, Flayra seems to be rather good at making the HL engine jump through hoops. Even so, there probably is some information out there on this topic.
 
painboi said:
Thanks for the info all.

I was able to reset the gravity to .0001. It is so low you might as well be in 0 grav.

i'm not sure why you don't just set the gravity to 0.. works fine for me.. also might want to change air_density to 0 as well.. all the objects in my no-gravity level work fine..
sv_gravity 0
air_density 0
or does CS not allow it like HL2 does?

seems like the trigger gravity brush could be used to kick on the gravity when within the trigger..(like when near the hull of a ship)
 
painboi said:
Um...How did they do it for Skulk? And for that matter what is skulk?

A monster in natural selection, basically they made it so all walls were ladders for skulks.
 
Back
Top