Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (OptimusPrime, AndrewAMD), 14,580 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: [camera] Follow an entity [Re: vlau] #151505
09/02/07 06:49
09/02/07 06:49
Joined: Aug 2006
Posts: 96
Netherlands
P
Polypfreak1987 Offline OP
Junior Member
Polypfreak1987  Offline OP
Junior Member
P

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
F
flits Offline
User
flits  Offline
User
F

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
P
Polypfreak1987 Offline OP
Junior Member
Polypfreak1987  Offline OP
Junior Member
P

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
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
function main()
{
cam_select();
while(1)
{
enz.


"empty"
Re: [camera] Follow an entity [Re: flits] #151509
09/02/07 09:13
09/02/07 09:13
Joined: Aug 2006
Posts: 96
Netherlands
P
Polypfreak1987 Offline OP
Junior Member
Polypfreak1987  Offline OP
Junior Member
P

Joined: Aug 2006
Posts: 96
Netherlands
Thanks, it works now

Page 2 of 2 1 2

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1