I have a very annoying problem and I have no idea how to deal with it.
I am making a gravity force without physic engine. I trace the ray from a falling object, and if it is in the air, it moves down. If it is below the terrain, it is placed on the terrain.
Code:
trace_to_ground = c_trace(my.x, vector(my.x,my.y,my.z-5000),IGNORE_ME|IGNORE_PASSENTS|IGNORE_PASSABLE|IGNORE_SPRITES|USE_BOX);
   	if(trace_to_ground > 0){
if(dummy.z <= target.z){
	dummy.z = target.z;
c_move(dummy,nullvector,vector(0,0,resultant_acc*time_step),GLIDE);


resultant_acc is the vertical movement down. The problem is, if resultant_acc is a big number say 15, the object traces down every 15 quants (as I understand it). But if for example the object is 7 quants above the terrain it then moves 15 quants down and appears to be 8 quants below the terrain. Since I have the hollow cube below the terrain, the object now detects it as a target and continues to fall down. To sum up, the object simply goes through terrain in some cases. If the resultant_acc value is small, like 0.3, the object moves down very slowly, though it never goes under ground. How to deal with this?


a generator of dull questions smile