Hello,

I'd like the camera to swing around and face certain targets (eg model entity etc)

I could use c-trace or a narrow scan to check that either the camera or player is facing the entity and wondered if there is another way?

I've managed to achieve partial success. When holding 1 the camera swings around to the entity. However, I would like the camera to swing until it faces the entity along with the player.

Would appreciate any help. Have included sample code below.

thanks,

Rob


function turn_to_target
{
var tempangle;
//while player is not facing target
//how to check if camera or player is facing target?
while (key_1)
{
//if the target is on a tilt
if(cam_target.skill14==1)
{
vec_diff(tempangle,cam_target.x,camera.x);
vec_to_angle(camera.pan,tempangle.x); //face target
}
else
{
// update direction
vec_to_angle(cam_target.skill17,vec_diff(cam_target.skill16,cam_target.x,camera.x));
// turn to the target
camera.pan += ang(cam_target.skill17-camera.pan)*0.2*time_step;
camera.tilt += ang(cam_target.skill8-camera.tilt)*0.2*time_step;
}
wait(1);
}
//player to face target also
vec_set(temp,cam_target.x);
vec_sub(temp,player.x);
vec_to_angle(player.pan,temp);
}