Hello! I'm trying to perfect some third-person movement code and I'm running into issues when my character attempts to walk up inclines at an angle. My gravity code and movement code must be to blame, but the solution eludes me. My gravity is pretty standard: I trace to the ground and place the model on the ground. If the model is within a block, I rise it up out of the block. I'm using version 7.06.

I posted a video on youtube the shows the choppy movement while moving up an incline diagonally: http://www.youtube.com/watch?v=6_wOHp-0Ejc

Going down the incline is no problem. Neither is going straight up.

Here's a cut down version of my movement code:

Code:
  
// Calculate the distance from the ground and position the player accordingly.

vec_set(vec1_from,my.x);
vec_set(vec1_to,my.x);
vec1_to.z -= 500;

result = c_trace(vec1_from, vec1_to, IGNORE_ME|IGNORE_PASSENTS|IGNORE_PASSABLE|IGNORE_SPRITES|USE_BOX);


// Handle Gravity

if (result > 0)
{
// Acceleration due to "gravity"
accelerate(move_to_vector.z, (-3 * time_step), 0); // fall

// If the acceleration of the fall would result in the player being moved below the ground, shorten
// the fall so that the player is put directly on to the ground.

if (move_to_vector.z < (result * -1))
{
move_to_vector.z = result * -1;
}
}

// If the player is within a block, push them up out of the block

if (result < 0)
{
// Trace from about 1/2 the player height down to the ground.

vec1_from.z += half_player_height;
result = c_trace(vec1_from, vec1_to, IGNORE_ME|IGNORE_PASSENTS|IGNORE_PASSABLE|IGNORE_SPRITES|USE_BOX);

move_to_vector.z = (half_player_height - result) * -1; // rise out of block
}

// If the player is exactly on the ground, don't apply any gravity or floating
if (result == 0)
{
move_to_vector.z = 0;
}

move_friction = 0.2;

// Move the player
c_move(me, move_to_vector, nullvector, GLIDE|IGNORE_SPRITES|IGNORE_PASSABLE);




Thanks for any advice!
- Bret