ok... from the beggining... sorry for my poor english...
1. camera is the name of template view (main view)
2. you can change camera's parameters by script using loops to make effects all the time
3. so if You write:
Code:
function camera_code
{
while(player != 0) //if player is in the level
{
vec_set(camera.x, player.x); //place camera at player position
wait(1);
}
}
camera will be all the time on players position. You may add this function in your main wdl and call it at the and of main function
camera_code();
4. What I've wrote in your post is the same but pressing "r" you'll change camera's parameters. So It will be still the same camera (view) but will be placed in different positions.
5. where I've wrote camera.arc...etc... replace it with what dj_pint wrote
So...
Code:
var camera_number; //number to change camera behaviour
var camera_dist[3] = -100,0,50; //vector to place camera relative to player
function hold_camera
{
while(player != 0) //if player is in the level
{
if(camera_number ==0) //if firs view
{
vec_set(camera.x, player.x); //camera at player position
camera.z = player.z + 50; //height of "eyes"
camera.pan = player.pan; //look where player is looking
}
if(camera_number ==1) //if second view
{
vec_set(temp, player.x);
vec_add(temp, camera_dist);
vec_set(camera.x,temp);
vec_set(temp,player.x);
vec_sub(temp,camera.x);
vec_to_angle(camera.pan,temp);
}
wait(1);
}
}
function change_camera
{
camera_number %= 2; //modulo = only 0 and 1
camera_number +=1; //change camera_number
}
on_r change_camera; //pressing "r" change camera_number
Or You may this easer just changing camera_dist vector
At the and of main function in main wdl write: hold_camera(); then paste all of those codes to your main script.
Code:
var camera_number; //number to change camera behaviour
var camera_dist[3]; //vector to place camera relative to player
function hold_camera
{
while(player != 0) //if player is in the level
{
if(camera_number ==0) //if first view
{
camera_dist = vector(0,0,50); //at player position but 50 quants up (eye height)
camera.pan = player.pan; //camera is looking in the same direction with player
}
if(camera_number ==1) //if second view
{
camera_dist = vector(-100,0,50); // 100 quants behind player
vec_set(temp,player.x); //where is the player
vec_sub(temp,camera.x); //where is camera
vec_to_angle(camera.pan,temp); //camera looks at player
}
vec_set(temp, player.x); //where is the player
vec_add(temp, camera_dist); //add distance to player position
vec_set(camera.x,temp); //set camera at this position
wait(1);
}
}
function change_camera
{
camera_number %= 2; //modulo = only 0 and 1
camera_number +=1; //change camera_number
}
on_r change_camera; //pressing "r" change camera_number