You are right, the entity does seem to sink into the ground, so a demo would allow conetic to see the effect (affect?). Maybe I'll code a short demo with toggleable move methods - c_move, ent_move, trace, and absolute vector.
To use trace to simulate gravity:
Code:
air = trace(my.x, temp.x); // assumes temp set up as above
if (air > 0)
{
velocity.z += gravity.z * time; // gravity.z is acceleration, so calc velocity at time, velocity is cumulative
// velocity is also good to calc damage from fall as speed kills when combined with a sudden stop
dist_moved.z = velocity.z * time; // how much distance would this velocity cover in this ammount of time
}
- or -
air = trace(my.x, temp.x);
if (air > 0)
{
my_time += time; // accumulate time since start of fall
dist_moved.z = gravity.z * my_time * my_time; // d = a * t^2 or d = a * t * t
}
else
{
my_time = 0; // no falling, so don't accumulate time, and reset my_time to 0
}
If you have something that doesn't fall through the floor partially, this code *should* do the 'falling' part of things without using the internal 3dgs physics engine.