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 / 3rd-Person Camera

Author
Message
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 19th Jul 2003 22:58
I want third person camera in my game, but i can't figuire out hoe to stay behind the car at all times. I would like it that when the car moves, so does the camera. Is this possible?
---Mattman
DID YOU KNOW THAT http://www.angelfire.com/vamp/epiccrossings/ILOVEDB.jpg[/img] ???
Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 19th Jul 2003 23:33
here s a subroutine to do that:

update_camera:
rem Position camera to the back of the character
ca#=wrapvalue(a#)
cx#=newxvalue(x#,ca#,-100)
cz#=newzvalue(z#,ca#,-100)
cy#=get ground height(car,x#,z#)
position camera cx#,cy#,cz#
rem Point camera at object
point camera x#,cy#,z#
return

a#=car angle
x#= car x position
z#=car z position
Zinc Avenger
21
Years of Service
User Offline
Joined: 29th Jan 2003
Location:
Posted: 19th Jul 2003 23:33
What I do when I want the camera to follow something is to keep setting the position of a hidden plane to the x, y and z of the object you want to follow, then position the camera relative to that object.

See the attached code.

In the code below, CAMTARGET is the hidden plane which follows the object. I can change which object is being followed by changing the value of FOCUS to the number of the object being followed. CAMDIST is the distance between the camera and the object being followed.

You could perhaps add a bit to make CAMTARGET point in the same direction as the object being followed, as the code attached won't do that for you (I have that part in a separate function, controlled by user input).

Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 25th Jul 2003 06:24
Sorry, i haven't been here, camera has been on bottom of list of things to do lately.

Scorpio: for a#, which angle? anglex, angley, or angle z?

Zinc : Neat idea, i will give both codes a try

---Mattman
DID YOU KNOW THAT ???
Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 26th Jul 2003 00:04
Sorry i did not specify it..it's the Y angle
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 26th Jul 2003 05:00
Will try in a minute...

---Mattman
DID YOU KNOW THAT ???

Login to post a reply

Server time is: 2024-09-20 17:50:17
Your offset time is: 2024-09-20 17:50:17