[ontopic]

Hi loopix! Thanks for the help. I do pan my player using c_rotate, but it doesn't make any difference. I'll post my entire move code below. I've tried a TON of different things to try to solve the problem. So far, no luck.

[offtopic]

Yes! I'm back! I found myself with some free time and I'm working on a "Goblin Fishing Game". It's an old project that I always wanted to make. It will be mission based fantasy fishing. Ha ha ha. My goal is to keep it as simple as possible. No pathfinding. No AI. As few animated 3d models as possible. It's good to be back.

Here's my entire movement code. I really want to get this perfect. Once I'm done, I'll be happy to share it with the community. Some of it is based off of other movement and animation code, such as the Kingdom Heart's movement tutorial.

Code:

action move_me()
{
VECTOR temp;
VECTOR move_to_vector;
VECTOR result;
VECTOR my_pan;

VECTOR vec1_from;
VECTOR vec1_to;

var camera_distance = 300;
var camera_height = 160;
var aspeed;
var bspeed;
var half_player_height = my.max_y
;
var mouse_pan_speed = 2;
var distance_to_ground;

var KEY_PAN_SPEED = 14;

c_setminmax(me);

// watched = my;

move_to_vector.x = 0;
move_to_vector.y = 0;
move_to_vector.z = 0;

while(1)
{

// Check scroll wheel
camera_distance += mickey.z * mouse_scroll_speed * time_step;

// Adjust camera height based on mouse y axis (optional)
// camera_height += mouse_force.y * mouse_tilt_speed * time_step;

vec_set(my_pan,nullvector);
vec_sub(my_pan, vector(accelerate(aspeed, 5 * mouse_force.x, 0.7),0,0)); // pan the camera
c_rotate(my,my_pan,IGNORE_PASSABLE);

// Get key input from the player for character movement

accelerate(move_to_vector.y, (key_d * strafe_speed * time_step * -1), 0.8); // strafe left
accelerate(move_to_vector.y, (key_a * strafe_speed * time_step), 0.8); // strafe right
accelerate(move_to_vector.x, (key_w * run_speed * time_step), 0.8); // go forward
accelerate(move_to_vector.x, (key_s * run_speed * time_step * -1), 0.8); // go back

// 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;

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

// Handle jump using spacebar

if (key_space)
{
if (distance_to_ground < 2)
{
distance_to_ground = 1;
move_to_vector.z = 5;
}
}


// Handle Gravity

if (distance_to_ground > 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 < (distance_to_ground * -1))
{
move_to_vector.z = distance_to_ground * -1;
}
}

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

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

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

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

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



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

// Move camera and handle animation
move_camera(camera_distance, camera_height);
handle_animation(1);

// Calculate new animation
if (abs(move_to_vector.x) > .5 || move_to_vector.y != 0) //if we are moving
{
if (my.animblend == stand) //if our current animation is stand
{
if (key_shift == 1) { my.blendframe = walk; } else { my.blendframe = run; }
}
if (my.animblend == run && key_shift == 1) { my.blendframe = walk; }
if (my.animblend == walk && key_shift == 0) { my.blendframe = run; }
}
else
{
if (my.animblend > stand) //if we aren't moving and our current animation is walk or run, blend and cycle the stand animation
{
my.blendframe = stand;
}
}

wait(1);
}

}