Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,388 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
camera for a driving/racing game?? #139450
07/04/07 08:37
07/04/07 08:37
Joined: Jul 2007
Posts: 24
N
noobie86 Offline OP
Newbie
noobie86  Offline OP
Newbie
N

Joined: Jul 2007
Posts: 24
hi all!
I have a problem with camera movement for car games.. when the car is moving in a straight line i want the camera to follow it at a particular distance and when it turns i want to be able to view a little of its side when its turning (a la the 3rd person camera of player_drive)..

i used the circular movement code i.e 'my.x-100*cos(my.pan)' and 'my.y-100*sin(my.pan)'.. it works well but it always shows the same view i.e. the butt of the car, so that it looks like a 2-D sprite moving in a 3d-world.. in other words, looks weird!!

can any1 pls give a hint as to how to script a camera like the 3rd person camera in player_drive.. just a hint, don't give the soln, i'll try to do it..
circular movement is enough for me, i don't want spherical movement.. i.e. camera.z = my.z is good enough..

thanks in advance!

Re: camera for a driving/racing game?? [Re: noobie86] #139451
07/04/07 10:08
07/04/07 10:08
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
Try this:

Code:
 
var camera_dist[3] = 100,0,-25; //play with those values to place camera where You want to

function camera_movement
{
while(player != 0)
{
CAMERA.pan += 0.1 * ang(player.pan-CAMERA.pan);
CAMERA.tilt += 0.1 * ang(player.tilt-CAMERA.tilt);
vec_set(temp,camera_dist);
vec_rotate(temp,player.PAN);
CAMERA.X += 0.4*(player.X - temp.X - CAMERA.X); //play with 0.4 to change delay
CAMERA.Y += 0.4*(player.Y - temp.Y - CAMERA.Y);
CAMERA.Z += 0.4*(player.Z - temp.Z - CAMERA.Z);
wait(1);
}
}



I hope that's what You want to
Cheers.

Last edited by tompo; 07/04/07 10:10.

Never say never.
Re: camera for a driving/racing game?? [Re: tompo] #139452
07/04/07 14:59
07/04/07 14:59
Joined: Jul 2007
Posts: 24
N
noobie86 Offline OP
Newbie
noobie86  Offline OP
Newbie
N

Joined: Jul 2007
Posts: 24
thanks tompo.. that script works very well and is flexible too.. it worked excellent with a level where i had used Newton for the car..

In another one where i had used ent_move for movement and normal.x etc for tilt and roll, the camera was panning and tilting too fast, but adjusting the values 0.1 0.4 etc made it better.. again it shows only the butt while turning, but its way better than what i was using.

thanks for the help


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

Gamestudio download | 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