Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (SBGuy, AndrewAMD), 1,410 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
[camera] Follow an entity #151495
09/01/07 12:26
09/01/07 12:26
Joined: Aug 2006
Posts: 96
Netherlands
P
Polypfreak1987 Offline OP
Junior Member
Polypfreak1987  Offline OP
Junior Member
P

Joined: Aug 2006
Posts: 96
Netherlands
Hello,

I have an entity wich is going up and down (along with the z-axis). I want to make a camera mode that stays on the ground an follow the entity wich is going up or down. I have tried c_trace and c_move, but without result.

How can I fix this?

Re: [camera] Follow an entity [Re: Polypfreak1987] #151496
09/01/07 12:38
09/01/07 12:38
Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
TSG_Torsten Offline

User
TSG_Torsten  Offline

User

Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
Hi,

you have to create a second entity. This could have a action like this:

action camera_ent
{
my.passable=on;
my.invisible=on;
while(1)
{
vec_set(my.x,your.x)// your.x=your entity
my.z-=c_trace(my.x,vector(my.x,my.y,my.z-5000),ignore_me+ignore_you);
vec_set(camera.x,my.x);
camera.pan=my.pan;
camera.tilt=my.tilt;
camera.roll=my.roll;
wait(1);
}
}


Haven't tested it, but it could work.

Regards
TSGames

Re: [camera] Follow an entity [Re: TSG_Torsten] #151497
09/01/07 13:00
09/01/07 13:00
Joined: Aug 2006
Posts: 96
Netherlands
P
Polypfreak1987 Offline OP
Junior Member
Polypfreak1987  Offline OP
Junior Member
P

Joined: Aug 2006
Posts: 96
Netherlands
Didn't work for now. Now it's just one view straight ahead and don't follow the entity:

Code:
action camera_ent
{
my.passable = on;
my.invisible = on;

while(1)
{
if(key_e == 1) {
vec_set(my.x,machine.x);// your.x=your entity
my.z -= c_trace(my.z,vector(my.x,my.y,my.z+1000),ignore_me+ignore_you);
vec_set(camera.z,machine.z);
camera.pan = my.pan;
camera.tilt = my.tilt;
camera.roll = my.roll;
}
wait(1);
}
}



Re: [camera] Follow an entity [Re: Polypfreak1987] #151498
09/01/07 13:02
09/01/07 13:02
Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
TSG_Torsten Offline

User
TSG_Torsten  Offline

User

Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
Haye you read my code?

Code:

...
vec_set(camera.z,machine.z);
...


has to be
Code:

...
vec_set(camera.x,my.x);
...



Regards
TSGames

Re: [camera] Follow an entity [Re: TSG_Torsten] #151499
09/01/07 13:21
09/01/07 13:21
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, that is working. But now I want to attach a key to it. If an user is pressing 5 the camera must be in a loop so that he follow the entity. Also if the user don't touch the button. I have the following code now:

Code:
action camera_ent
{
my.passable = on;
my.invisible = on;

while(1)
{
if(key_5 == 1) {
vec_set(my.x,machine.x);// your.x=your entity
my.z -= c_trace(my.z,vector(my.x,my.y,my.z-5000),ignore_me+ignore_you);
vec_set(camera.x,my.x);
camera.pan = my.pan;
camera.tilt = my.tilt;
camera.roll = my.roll;
}
wait(1);
}
}



Re: [camera] Follow an entity [Re: Polypfreak1987] #151500
09/01/07 13:31
09/01/07 13:31
Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
TSG_Torsten Offline

User
TSG_Torsten  Offline

User

Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
Sorry, I don't understand this sentences:
Quote:


If an user is pressing 5 the camera must be in a loop so that he follow the entity. Also if the user don't touch the button.




It should follow in both cases? If yes, you don't have to write any if-condition.

Regards
TSGames

Re: [camera] Follow an entity [Re: TSG_Torsten] #151501
09/01/07 15:01
09/01/07 15:01
Joined: Aug 2006
Posts: 96
Netherlands
P
Polypfreak1987 Offline OP
Junior Member
Polypfreak1987  Offline OP
Junior Member
P

Joined: Aug 2006
Posts: 96
Netherlands
Imagine. You are playing the game/simulation. You are viewing the entity. If you press the 5-button on your keyboard the camera switches to the right position (wich follows the entity of the code you gave me).

I move the entity up and down with the q/a-button. But when I do that the entity goes up, but the camera stay at one place (the camera only moves when I press and hold the 5-button). So my question is: Is there a manner to move the camera without to press and hold the 5-button. So the camera is attached to the entity?

Re: [camera] Follow an entity [Re: Polypfreak1987] #151502
09/01/07 16:28
09/01/07 16:28
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
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);
}
}



Re: [camera] Follow an entity [Re: vlau] #151503
09/01/07 16:56
09/01/07 16:56
Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
TSG_Torsten Offline

User
TSG_Torsten  Offline

User

Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
If i understand you right: Just remove the

if(key_5 == 1)

Regards
TSGames

Re: [camera] Follow an entity [Re: TSG_Torsten] #151504
09/01/07 17:24
09/01/07 17:24
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
var key_5_on;

function dontknow
{
while(1)
{
if(key_5 == 1 && key_5_on == 1)
{
run +=1;
run %= 2;
key_5_on == 0;
}
if(key_5 == 0)
{
key_5_on == 1;
}
if(run == 1)
{
camera.x = my.x;
camera.y = my.y;
camera.z = my.z;
vec_diff(temp,my.x,camera.x);
vec_to_angle(camera.pan,temp);
}
wait(1);
}
}


"empty"
Page 1 of 2 1 2

Gamestudio download | chip programmers | 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