Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,203 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Object that must fly with the camera #211960
06/19/08 11:18
06/19/08 11:18
Joined: Mar 2008
Posts: 104
theDust Offline OP
Member
theDust  Offline OP
Member

Joined: Mar 2008
Posts: 104
Hi, i have the problem that when i move my modell that must fly behind the camera, the modell( or the camera ) don't fit any more. They offset any time i press the move-button. Here the code:

action player()
{
while (1)
{
camera.pan -= mouse_force.x * 1.5;
camera.tilt += mouse_force.y * 1.5;
camera.x = my.x;
camera.y = my.y;
camera.z = my.z;
my.pan = camera.pan;
my.tilt = camera.tilt;
if (key_w) c_move (my, vector(15*time_step, 0, 0), nullvector, GLIDE);
if (key_s) c_move (my, vector(-15*time_step, 0, 0), nullvector, GLIDE);
wait (1);
}
}

That code is an action for the playermodell. I hope you understand the problem, when not try the code out wink

Re: Object that must fly with the camera [Re: theDust] #211970
06/19/08 12:13
06/19/08 12:13
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
I'm not sure, if I understand anything, but you could try the code like this, because in your code the camera's position is always set to the player's position after the wait, means a tick later than it should:

action player()
{
while (1)
{
if (key_w) c_move (my, vector(15*time_step, 0, 0), nullvector, GLIDE);
if (key_s) c_move (my, vector(-15*time_step, 0, 0), nullvector, GLIDE);
camera.pan -= mouse_force.x * 1.5;
camera.tilt += mouse_force.y * 1.5;
camera.x = my.x;
camera.y = my.y;
camera.z = my.z;
my.pan = camera.pan;
my.tilt = camera.tilt;
wait (1);
}
}

Re: Object that must fly with the camera [Re: Pappenheimer] #211973
06/19/08 12:21
06/19/08 12:21
Joined: Mar 2008
Posts: 104
theDust Offline OP
Member
theDust  Offline OP
Member

Joined: Mar 2008
Posts: 104
And again a easy sollution laugh Big Thx


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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