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
1 registered members (1 invisible), 857 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
3rd person camera help #307617
01/30/10 14:55
01/30/10 14:55
Joined: Jul 2008
Posts: 21
M
MrNoOne Offline OP
Newbie
MrNoOne  Offline OP
Newbie
M

Joined: Jul 2008
Posts: 21
I'm working on a 3rd person camera on my game, I have most of it done, but I need help with the tilt. I want my camera to tilt around the player when looking up or down. At the moment when I look down it just looks down from where the camera is, which I do not want. I searched around for this, but I did not find anything. Please help. Thanks.

Re: 3rd person camera help [Re: MrNoOne] #307618
01/30/10 15:15
01/30/10 15:15
Joined: Feb 2008
Posts: 18
davinski Offline
Newbie
davinski  Offline
Newbie

Joined: Feb 2008
Posts: 18
We cant help you without seeing the code.
Please post it!


GameStudio A7 Extra
ultitech - Ultimative Technology
Re: 3rd person camera help [Re: davinski] #307620
01/30/10 15:39
01/30/10 15:39
Joined: Jul 2008
Posts: 21
M
MrNoOne Offline OP
Newbie
MrNoOne  Offline OP
Newbie
M

Joined: Jul 2008
Posts: 21
this is the code:

function handle_camera()
{

camera.x = my.x - fcos(my.pan, 120);
camera.y = my.y - fsin(my.pan, 120);
camera.z = my.z + 30;

camera.pan = my.pan;
camera.tilt += (mouse_force.y*5);
//////
//////
if(camera.tilt > 90)
{
camera.tilt = 90;
}
else if (camera.tilt < -90)
{
camera.tilt = -90;
}

}


Last edited by MrNoOne; 01/30/10 15:40.
Re: 3rd person camera help [Re: MrNoOne] #307647
01/30/10 19:04
01/30/10 19:04
Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
Tobias Offline

Moderator
Tobias  Offline

Moderator

Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
You must do the same thing as for the pan, move the camera up and down when tilting down and up, try this:

camera.z = my.z + 30 - 120*sin(camera.tilt);

Havent tried it myself but thats the general idea.

Re: 3rd person camera help [Re: Tobias] #307653
01/30/10 19:32
01/30/10 19:32
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
...and something for the code, replace:

if(camera.tilt > 90)
{
camera.tilt = 90;
}
else if (camera.tilt < -90)
{
camera.tilt = -90;
}

with:

clamp (camera.tilt,90,-90);

Re: 3rd person camera help [Re: Widi] #307658
01/30/10 20:00
01/30/10 20:00
Joined: Jul 2008
Posts: 21
M
MrNoOne Offline OP
Newbie
MrNoOne  Offline OP
Newbie
M

Joined: Jul 2008
Posts: 21
The clamp does not work for me which is why I have the other code.

Re: 3rd person camera help [Re: MrNoOne] #307780
01/31/10 14:55
01/31/10 14:55
Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
Tobias Offline

Moderator
Tobias  Offline

Moderator

Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
I think the correct way is camera.tilt = clamp(camera.tilt,90,-90);

At least its this way described in the manual.


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