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
0 registered members (), 1,251 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
camera following a player, does not work when model is rotated #299994
11/28/09 18:57
11/28/09 18:57
Joined: Jun 2009
Posts: 38
H
hungryhobo Offline OP
Newbie
hungryhobo  Offline OP
Newbie
H

Joined: Jun 2009
Posts: 38
so, I want to have my camera follow a player, but because the model tilts and rolls the camera doesnt follow the player properly. my code works for characters that dont rotate around does anyone know how i can have it work for rolling, "ball" entities?

here is a portion of my code, if you really need it.

function check_view()
{
my = player;
var dist_trace; //variable to store trace;
trace_mode = ignore_me + ignore_passable;
dist_trace = trace(player.x,camera.x);

if(dist_trace == 0){return; } //if there is no obstruction do nothing
if(dist_trace < cam_tdistance)
{
dist_trace -= 5; //move out from wall;
cam_pdistance = cos(cam_tilt)*dist_trace;
camera.x = player.x - cos(cam_angle)*cam_pdistance; //keep the camera within the circle around the player
camera.y = player.y- sin(cam_angle)*;
camera.z = player.z+ sin(cam_tilt)*dist_trace;
camera.pan =0; //cam_angle + player.pan;
}


}

Re: camera following a player, does not work when model is rotated [Re: hungryhobo] #300032
11/29/09 03:39
11/29/09 03:39
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi!

This line is your problem

camera.pan =0; //cam_angle + player.pan;

The camera is always at zero degres...
The camera must have the same pan angle as the player.
in Lite-c use vec_set (camera.pan,player.pan);


Hope this helps!
Ottawa laugh

Ver 7.86.2 Pro and Lite-C
Re: camera following a player, does not work when model is rotated [Re: Ottawa] #300114
11/29/09 21:13
11/29/09 21:13
Joined: Jun 2009
Posts: 38
H
hungryhobo Offline OP
Newbie
hungryhobo  Offline OP
Newbie
H

Joined: Jun 2009
Posts: 38
unfortunately that doesnt work. because the model is tilting and rolling, the camera does the same when i do that.

thank you though.

Re: camera following a player, does not work when model is rotated [Re: hungryhobo] #300119
11/29/09 21:38
11/29/09 21:38
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Why you don`t set only the pan from the camera?

camera.pan = player.pan;


Moderated by  HeelX, rvL_eXile 

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