Gamestudio Links
Zorro Links
Newest Posts
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
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Ayumi, 1 invisible), 584 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
[help] can some explain this third person shooter camera code #252586
02/19/09 04:31
02/19/09 04:31
Joined: Jan 2009
Posts: 5
T
tom2004 Offline OP
Newbie
tom2004  Offline OP
Newbie
T

Joined: Jan 2009
Posts: 5
can someone explain this 3rd person shooter camera

camtilt=clamp(camtilt,-85,85);//clamp is only allow camtilt'value between -85 and 85
cam_dist//the distance from player to camera
fcos()//cos()*factor
fsin()//sin()*factor

////////
temp2=fcos(camtilt,-cam_dist);
vec_set(camera.x,vector(player.x+fcos(player.pan,temp2),player.y+fsin(player.pan,temp2),player.z+fsin(camtilt,-cam_dist)));
////////

the problem is when i change vec_set to below this the camera's up down become weird can't reach 85 degree up and down and camera only can move up and down a little bit

///////
vec_set(camera.x,vector(player.x+fcos(player.pan,-cam_dist),player.y+fsin(player.pan,-cam_dist),player.z+fsin(camtilt,-cam_dist)));
///////

Re: [help] can some explain this third person shooter camera code [Re: tom2004] #252623
02/19/09 10:26
02/19/09 10:26
Joined: Jan 2009
Posts: 5
T
tom2004 Offline OP
Newbie
tom2004  Offline OP
Newbie
T

Joined: Jan 2009
Posts: 5
nobody? maybe this is too hard

Re: [help] can some explain this third person shooter camera code [Re: tom2004] #252649
02/19/09 12:56
02/19/09 12:56
Joined: May 2008
Posts: 331
Lithuania, Vilnius
Jaxas Offline
Senior Member
Jaxas  Offline
Senior Member

Joined: May 2008
Posts: 331
Lithuania, Vilnius
it's trigonometry, if you understand it, you'll understand that wink and also it's difficult example, find for easy wink


The smaller the bug, the harder it is to kill.
_________________________________________
Forklift DEMO (3dgs)
Re: [help] can some explain this third person shooter camera code [Re: Jaxas] #253076
02/22/09 15:29
02/22/09 15:29
Joined: May 2008
Posts: 10
UK
C
cjm Offline
Newbie
cjm  Offline
Newbie
C

Joined: May 2008
Posts: 10
UK
The 3rd person view is basically formed by offsetting the camera from the player in x,y and z, normally behind to oneside and above the player. This requires subtracting from the players x, y and z a distance. This is what the cam_dist does, note the minus sign.

The probelem comes when the player pans, you want the camera to swing round the player so it is in the same position relative to the player and therfore faithfully tracks a fixed position relative to the player.

Thats what the trigonometry does. The player.pan angle is resolved in x and y and these distances are used to adjust the camera position.

Hope this helps.

Re: [help] can some explain this third person shooter camera code [Re: cjm] #253356
02/24/09 10:09
02/24/09 10:09
Joined: Jan 2009
Posts: 5
T
tom2004 Offline OP
Newbie
tom2004  Offline OP
Newbie
T

Joined: Jan 2009
Posts: 5
thx guys


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