Posted By: sadsack
Darn camera - 10/01/08 19:50
Hi,
well i am trying to make the camera go and turn the same way as a ship. I want it to look like you (the camera) is flying the ship
CODE:
The code does what I ask it to do untill I start to move the ship. The camera is right in the pilot set when the program start. But when you move or turn the ship, the camera does not move or turns.
What am I over looking?????
Thank You
renny
well i am trying to make the camera go and turn the same way as a ship. I want it to look like you (the camera) is flying the ship
CODE:
Code:
////////////////////////////////////////////////////////////////////
ENTITY* ship;
function create_camera()
{
while(1) {
vec_set(camera.x+100,ship.x);///////////////////////////////////////////////////////
vec_set(camera.y,ship.y);///////////// move the camera together with the ship entity
vec_set(camera.z,ship.z);//////////////////////////////////////////////////////////
vec_set(camera.pan,ship.pan);} //turn camera with ship
wait(1);
}
action act_ship()
{
ship = me;
while(1)
{
if (key_z) {me.pan += 3*time_step;}
if (key_x) {me.pan -= 3*time_step;}
if (key_a){c_move (me,vector( -.3,0,0),nullvector,GLIDE);}
if (key_s){c_move (me,vector( .3,0,0),nullvector,GLIDE);}
wait(1);
}
}
function main()
{
video_screen = 1;
video_mode = 7;
level_load ("");
ent_create("ship.mdl", vector(0, 0, 0), act_ship);
//ent_create("ship1.mdl", vector(200, 0, 0), NULL);
}
The code does what I ask it to do untill I start to move the ship. The camera is right in the pilot set when the program start. But when you move or turn the ship, the camera does not move or turns.
What am I over looking?????
Thank You
renny