Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / How do you create a 3rd person camer?

Author
Message
Dark FLAS
22
Years of Service
User Offline
Joined: 18th Sep 2002
Location:
Posted: 22nd Sep 2002 01:54
Ive always wanted to create a 3rd person game for example "a raceing game, FPS game etc" i can get most of the code right but when it comes to the camera i mess it all up if any one could help me plz email me on
I will code your ass!!
Coolguy
22
Years of Service
User Offline
Joined: 2nd Oct 2002
Location:
Posted: 3rd Oct 2002 06:51
if you go to the darkbasic site go to the creat page then to online tutorial page it shows you there under the third person on a matrix link

The Darthster
22
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 4th Oct 2002 01:32
Ok the main object in your game will have an (x,y,z) position and an angle. To put the camera behind it, you need to use the newxvalue and newzvalue commands. These work by: you put in an angle and a distance and it will move an object (or the camera) that far in that direction. To get 3rd person you need to put the camera directly behind the object. Note:- all this assumes you are working with 2 dimensional camera movement, i.e. you'll only ever have to rotate it around the y-axis, the y position is generally fixed in relation to the object, like in most car racing games. 3 dimensional camera movement, for example in space fighter games, is much harder. I haven't quite managed to perfect it myself.



Where camerax#, cameray# and cameraz# are the camera coordinates, x#, y# and z# are the object coordinates, an# is the y-axis angle of the object, dist# is the distance you want the camera from the object, and height# is the height above the object that you want the camera to be. The angle used is (an#+180) because we want the camera to be 180 degrees around the object, which is behind it.

Hope you understand that.
Kale
22
Years of Service
User Offline
Joined: 8th Sep 2002
Location: United Kingdom
Posted: 4th Oct 2002 20:38
or you could use the in-built 'SET CAMERA TO FOLLOW' command?

SET CAMERA TO FOLLOW
This command automatically controls the camera to provide a tracking system. By providing the 3D world coordinate of
the entity you wish to track, and some camera data, your camera will automatically update its current position each time
this command is called. The X, Y, Z and Angle values provide the coordinate to track. The Distance value specifies the
required distance between the coordinate and the camera. The Height value specifies the required height of the camera
in 3D space. The Smooth value specifies the level of smoothing required for the camera, where a value of 1.0 is no
smoothing and a value of 100.0 is lots of smoothing. The Collision value is a special flag that allows the camera to detect
whether it is hitting any of the static collision boxes and if set to one will automatically adjust so as not to enter these
collidable areas.

SYNTAX
SET CAMERA TO FOLLOW X, Y, Z, Angle, Distance, Height, Smooth, Collision
SET CAMERA TO FOLLOW Camera Number, X, Y, Z, Angle, Distance, Height, Smooth, Collision


What the flame does not consume, consumes the flame.
----------------------------------------------------------------------
AMD XP2100+, Geforce4Ti 4400, 512Mb DDR, Abit KX7, WinXP Pro
Kale
22
Years of Service
User Offline
Joined: 8th Sep 2002
Location: United Kingdom
Posted: 4th Oct 2002 20:38
BTW RTFM

What the flame does not consume, consumes the flame.
----------------------------------------------------------------------
AMD XP2100+, Geforce4Ti 4400, 512Mb DDR, Abit KX7, WinXP Pro

Login to post a reply

Server time is: 2024-11-23 15:44:22
Your offset time is: 2024-11-23 15:44:22