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 / following camera

Author
Message
Mr Inquisitive
19
Years of Service
User Offline
Joined: 5th Feb 2005
Location: Who Cares?
Posted: 8th Feb 2005 06:34
how do you I make it so that the camera follows the moving main character?

I walk alone, down a street that I call home, and wonder why God is so mean to me.
Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 8th Feb 2005 07:15
theres several ways, theres some functions in the codebase, and im trying to use one but it seems bugged.

Video games…they can take you places unreachable, impossible, unfeasible. They put you in the book...they put you in the movie...they put you in a world, a world that before could only be imagined.
Clueless
20
Years of Service
User Offline
Joined: 16th Feb 2004
Location: Corbin, KY, USA
Posted: 8th Feb 2005 08:57
There's a command like SET CAMERA TO FOLLOW but the parameters are kind of counter-intuitive as some of the angles/distances appear to be relative to the object you're following while others are relative to the 3D world space. You may find your camera pointing off into BFE when the object you're following changes direction. Getting the X,Y,Z coords of the object you're following, then POINT CAMERA to those coords, should take care of that.

I've always used a "dumbed down" version of code in one of the DB help files -- the "free flight" example, I believe it is called, where you've got the boxy little "airplane" inside a wireframe sphere. They take advantage of the fact that if you change an object's or camera's position more than once in between SYNC calls, the camera only "sees" the object where it exists when you call SYNC, from the position of the camera when you call SYNC.

Consider what happens if you:
1. SYNC ON ` screen updates only when you call SYNC now
2. Move the object that you want to follow
3. Move your camera to the object's position
4. Set your camera orientation to the object's orientation
5. Move the camera a negative distance
6. SYNC

You've moved the camera twice, but as far as your program is concerned, when you issue SYNC to update the screen, your camera is behind the object you're following and it's pointing at that object.

The sample code in the DB help introduces another object, a small sphere that they move along behind the airplane instead of the camera, then they set the camera position to the sphere's position. The end result is really the same.

Login to post a reply

Server time is: 2024-09-23 11:26:13
Your offset time is: 2024-09-23 11:26:13