|
|
Re: [camera] Follow an entity
[Re: vlau]
#151505
09/02/07 06:49
09/02/07 06:49
|
Joined: Aug 2006
Posts: 96 Netherlands
Polypfreak1987
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2006
Posts: 96
Netherlands
|
Quote:
You may place the camera in a certain distance away from your entity, when you move the entity, move the camera also and keep it always look at your entity.
Code:
action yourEntity { while(1) { // entity move code //.....
// Place the camera in a certain distance // away from the entity camera.x = my.x + 15; // play with 15 camera.y = my.y + 15; // play with 15 camera.z = my.z + 2; // play with 2 // Always look at the entity vec_diff(temp,my.x,camera.x); vec_to_angle(camera.pan,temp); wait(1); } }
This one almost works correctly. I put this code into a function because I have more camera views. But when I want to change the camera mode, it didn't change.
This is the function of the camera views with the keys.
Code:
function cam1() { camera.x = -112; camera.y = 0; camera.z = 16; camera.pan = 0; camera.tilt = 0; camera.roll = 0; }
function cam2() { camera.x = -160; camera.y = 0; camera.z = 16; camera.pan = 0; camera.tilt = 20; camera.roll = 0; }
function cam3() { camera.x = -250; camera.y = 0; camera.z = 16; camera.pan = 0; camera.tilt = 45; camera.roll = 0; }
function cam4() { camera.x = -22; camera.y = -42; camera.z = 9; camera.pan = 60; camera.tilt = 0; camera.roll = 0; }
function cam5() { while(1) { // Place the camera in a certain distance // away from the entity camera.x = machine.x + 40; // play with 15 camera.y = machine.y + 40; // play with 15 camera.z = machine.z + 10; // play with 2 // Always look at the entity vec_diff(temp,machine.x,camera.x); vec_to_angle(camera.pan,temp); wait(1); } }
on_1 = cam1; on_2 = cam2; on_3 = cam3; on_4 = cam4; on_5 = cam5;
When I press the 5-button the cam is good. But when I press the 1-button for example, the view did not change.
So how can I fix this problem?
|
|
|
Re: [camera] Follow an entity
[Re: Polypfreak1987]
#151506
09/02/07 07:57
09/02/07 07:57
|
Joined: Jul 2007
Posts: 959 nl
flits
User
|
User
Joined: Jul 2007
Posts: 959
nl
|
var cam_s;
function cam5() { while(1) { if(cam_s == 5) { camera.x = machine.x + 40; camera.y = machine.y + 40; camera.z = machine.z + 10; vec_diff(temp,machine.x,camera.x); vec_to_angle(camera.pan,temp); } wait(1); } }
function cam_select { cam5(): while(1) { if(key_1 == on) { cam_s =1; cam5(): } if(key_2 == on) { cam_s =2; cam5(): } if(key_3 == on) { cam_s =3; cam5(): } if(key_4 == on) { cam_s =4; cam5(): } if(key_5 == on) { cam_s =5; } wait(1); } }
"empty"
|
|
|
Re: [camera] Follow an entity
[Re: flits]
#151507
09/02/07 08:57
09/02/07 08:57
|
Joined: Aug 2006
Posts: 96 Netherlands
Polypfreak1987
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2006
Posts: 96
Netherlands
|
Quote:
var cam_s;
function cam5() { while(1) { if(cam_s == 5) { camera.x = machine.x + 40; camera.y = machine.y + 40; camera.z = machine.z + 10; vec_diff(temp,machine.x,camera.x); vec_to_angle(camera.pan,temp); } wait(1); } }
function cam_select { cam5(): while(1) { if(key_1 == on) { cam_s =1; cam5(): } if(key_2 == on) { cam_s =2; cam5(): } if(key_3 == on) { cam_s =3; cam5(): } if(key_4 == on) { cam_s =4; cam5(): } if(key_5 == on) { cam_s =5; } wait(1); } }
This didn't work...
|
|
|
Re: [camera] Follow an entity
[Re: Polypfreak1987]
#151508
09/02/07 09:06
09/02/07 09:06
|
Joined: Jul 2007
Posts: 959 nl
flits
User
|
User
Joined: Jul 2007
Posts: 959
nl
|
function main() { cam_select(); while(1) { enz.
"empty"
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|
|
|