Navigation

 Moon Walking Feature Type: Coding Tutorials     Added: 24/01  
  Author: Corven 

Just like bouncing on the moon, with low gravity. [update 4 feb 2002]

Just walking on the moon

Code to be Deleted or Commented out
Code to be Added or Changed

g_active.c

Find the ClientThink_real function, and look for this line:

client->ps.gravity = g_gravity.value;

This tells the game what value to set the gravity based on its server cvar. We are just going to remove or comment out the original line, and make a simple change, like this:

//client->ps.gravity = g_gravity.value;
client->ps.gravity = g_gravity.value * 0.25;

And now the gravity is only a quarter of it's usual value, it has the effect ingame just like moon walking ;)

Here's a little extra coding, same function, same place, only this will leave the original gravity value, but will cause you to jump and float down, try this:

client->ps.gravity = g_gravity.value;
if (client->ps.velocity > 0) { //moving upwards
client->ps.gravity = g_gravity.value * 0.50; //half gravity
} else { //moving down
client->ps.gravity = g_gravity.value * 0.25; //quarter gravity
}


It will alter the a slightly higher gravity as you bounce upwards, but then lower gravity for a slower fall back to the ground.

Comments »



  Page 1

  Comments ( 0 )


  Features Index

  Home

Copyright 2001 MGON International AB - Privacy statement