to post some code use [code] at the beginning and [/code] at the end wink

and it'll look like this: (much easier to read)
Code:
var distance, angle;
VECTOR temp;
distance = 400;
angle =0;

VECTOR move_vec; // NEW | the movement vector

while(me)
{
	if(player)
	{
		camera.x = player.x-distance*cos(angle);
		camera.y = player.y-distance*sin(angle);
		camera.z = player.z+100;
		
		vec_set(temp,player.x);
		vec_sub(temp,camera.x);
		vec_to_angle(camera.pan,temp);
		vec_set(camera.tilt,player-300);
	}
	
	vec_set(move_vec, vector(joy_force.x * 7 * time_step, joy_force.y * 7 * time_step, 0)); // NEW
	
	vec_rotate(move_vec, vector(camera.pan, 0, 0)); // NEW
	
	c_move(me, nullvector, move_vec, GLIDE); // CHANGED
}



I marked new lines with // NEW at the end and changed lines with // CHANGED

It's actually really simple:

you moved your player with this:
c_move(me, nullvector, vector(joy_force.x * 7 * time_step, joy_force.y * 7 * time_step, 0), GLIDE);


I just created a new vector called move_vec, which is set to your previous movement vector (the blue one above) every frame by doing this:

vec_set(move_vec, vector(joy_force.x * 7 * time_step, joy_force.y * 7 * time_step, 0));


After this I rotate this vector with the camera's pan-angle:
vec_rotate(move_vec, vector(camera.pan, 0, 0));

And then move the player:
c_move(me, nullvector, move_vec, GLIDE);

Last edited by Kartoffel; 09/03/12 12:46.

POTATO-MAN saves the day! - Random