Friday, December 20, 2013

How to disable gravity in Source Engine

For this snippet, we will be modifying the CPhysicsHook class. Open up server/physics.cpp and edit the LevelInitPreEntity function. Find the physenv->SetGravity( Vector( 0, 0, -GetCurrentGravity() ) ); line. Change the setting GetCurrentGravity to zero.

Then you need to create any map and put it prop_physics objects. The objects will be able to rest or will move infinitely in the direction in which they push.

Also, read an article about the gravity on https://developer.valvesoftware.com/wiki/Gravity.