Posted By: mEnTaL
Can you correct this script - 07/01/09 12:25
I'm trying to make FPS camera. The code works, but there are 2 annoying bugs in it:
1) The camera constantly glides over the terrain and can't stop.
2) I can't set tha camera's height in relation to the terrain.
Here is the code:
action free_camera
{
my.invisible = on;
while (1)
{
my.pan -= 10 * mouse_force.x * time_step;
my.tilt += 10 * mouse_force.y * time_step;
c_move(my,vector ((key_w-key_s)*30*time_step,(key_a-key_d)*30*time_step,0),nullvector,GLIDE);
c_move(me,vector(0,0,-10),NULLVECTOR,GLIDE); //my simple code for gravity
vec_set(camera.x, my.x);
vec_set(camera.pan,my.pan);
wait(1);
}
}
1) The camera constantly glides over the terrain and can't stop.
2) I can't set tha camera's height in relation to the terrain.
Here is the code:
action free_camera
{
my.invisible = on;
while (1)
{
my.pan -= 10 * mouse_force.x * time_step;
my.tilt += 10 * mouse_force.y * time_step;
c_move(my,vector ((key_w-key_s)*30*time_step,(key_a-key_d)*30*time_step,0),nullvector,GLIDE);
c_move(me,vector(0,0,-10),NULLVECTOR,GLIDE); //my simple code for gravity
vec_set(camera.x, my.x);
vec_set(camera.pan,my.pan);
wait(1);
}
}