Okay my way is kinda crazy simple and basically works like real life. I don't know if it will help.

Youre player has 3 alocated skils for absolute movement so in c_move you put

c_move(me,vector(my.speedx,0,0), vector(my.absx, my.absy, my.absz), GLIDE)

where absx absy and absz are the absolute (i.e. aligned to room axis) movements

Somewhere you do a trace that checks to see if the player is NOT on the floor if so you increase the my.absz by your gravity amount. If the player is on the floor then the increasing the my.absz stops so they nolonger accelerate and my.absz = 0 so they stop falling.

For jumping all you do is check that the player is on the ground then if it is, when a key is pressed my.absz = 20 (or some suitable value) this cause the player to jump up in the air and then the gravity kicks in dropping them back to the ground smoothly.

um yeah I rushed that so if it didn't make sense here's my current game code showing the trace that handles the whole thing.

 Code:
// gravity trace
		vec_set(temp.x, my.x);  // copies entity x/y/z/ to the temp vector
      temp.z -= 99999; // we set the temp vector ? quants straight down, below the entity
		result = c_trace(my.x,temp.x,IGNORE_ME|IGNORE_PASSABLE|USE_BOX|USE_POLYGON|IGNORE_PUSH); // do a trace and make result = to the found value
		if(result > 0) // chech to see if an obstacle was hit, if so start the falling action
		{
			my.absz -= my.grav_acc*time; // fall
			my.res = 0.2;
		}
		if((result < 60) && (result > 0)) // check to see if the entity is on the ground, if so stop falling
		{
			my.absz = 0;
			my.res = 0.5;
		}
		if((result < 40) && (result >0)) // check if entity is bellow ground (fallen through) if so rise up
		{
			my.absz += 40*time;
			my.res = 0.5;
		}
		if(result == 0) // if nothing is bellow the entity i.e. outside room area, then gravity stops
		{
			my.absz -= my.grav_acc*time;
		}
 



If you need help with my rushed message I will probably be around some other time to reexplain it I have to go so I hope that helped.

Sydan


For some reason, my ambition always seems to beat my ability.