Gamestudio Links
Zorro Links
Newest Posts
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 (TipmyPip, AndrewAMD), 1,151 guests, and 4 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
camera zoom from 3rd person to 1st #205729
05/08/08 10:27
05/08/08 10:27
Joined: May 2008
Posts: 18
T
the4d Offline OP
Warez Kiddie
the4d  Offline OP
Warez Kiddie
T

Joined: May 2008
Posts: 18
i'm fairly sure this should be possible,
so can somebody tell me how i can code it so that the game starts with the camera in 3rd person, then zooms into first, kinda like an orientation or an intro.

Re: camera zoom from 3rd person to 1st [Re: the4d] #205765
05/08/08 16:45
05/08/08 16:45
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Hi,

this is quiet easy if you write the camera management in a proper way (the following code is written in C-Script). I would differentiate different camera styles through a simple state variable, e.g.

var camState;

Whereas 0 means undefined and there camera doesnt move/rotate, 1 means first person and 2 means third person.

Now, I would write a camera function which has a loop. In this loop you check this state and if it is >0, you call a function camFirstPerson() if it is == 1 and function camThirdPerson(). These function calculate the target position of the camera with everything you need to take into account, e.g. collision. The important thing is, that these functions DON'T SET the camera to this target position and rotation. The target position and rotation could be saved in globals:

var camTargetPos[3];
var camTargetPan[3];

After you have called these functions in your camera loop, you have to process this information to move the camera to this location. This is the point in which you interpolate the current camera position and rotation to the target position. You could call for instance a function camInterpolate(); which does exactly this job. You just take the camera's .x location and .pan rotation and the target counterparts and interpolate. For the spacial interpolation you could take vec_lerp. For the angular rotation you could use the function ang_lerp which I introduce here as Lite-C script (it is easy to convert it to C-Script): http://www.coniserver.net/ubb7/ubbthreads.php?ubb=showflat&Main=22242&Number=184968#Post184968

As long as you want the camera to be in 3rd person mode, you set camState = 2; and when you change into 1st person mode, you set camState = 1; Because of the dynamic interpolation, the camera translates automatically from the 3rd person camera position to the 1st person camera position.

Thats it! - I hope, this helps.

Good luck,
- Christian

Re: camera zoom from 3rd person to 1st [Re: HeelX] #206226
05/12/08 08:08
05/12/08 08:08
Joined: May 2008
Posts: 18
T
the4d Offline OP
Warez Kiddie
the4d  Offline OP
Warez Kiddie
T

Joined: May 2008
Posts: 18
confusing, but i think itll help me.
thanks a lot!


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