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 make the camera follow an object?

Author
Message
Galyxi
19
Years of Service
User Offline
Joined: 8th Sep 2005
Location: Using DBC
Posted: 12th Sep 2005 19:47
*Using DBC*



Just a question. Is there a way of getting the camera to follow an object? I have the command *set camera to follow* but it doesnt seem to actually follow the object. Did I cancel it out by putting *rotate camera* command in there? OR do you have to code it yourself, ie

do
if upkey()=1 then move object 1,1
position camera objectsXposition#,objectsYposition#,objectsZposition
sync
loop

or is there just a command which tells it to follow the object.

Thanks for the help!

PS Ive posted the code above and just noticed an error whilst testing it. When i press the keys to tell it to rotate, it does funny things (rotates fine but doesnt start rotating from 0 degrees)

If anyone has any ideas about the second thing that'd be great too!
Galyxi
19
Years of Service
User Offline
Joined: 8th Sep 2005
Location: Using DBC
Posted: 12th Sep 2005 22:15
got the rotating bug working, code now looks like this:

Galyxi
19
Years of Service
User Offline
Joined: 8th Sep 2005
Location: Using DBC
Posted: 13th Sep 2005 17:35
*bump*
WarGoat
20
Years of Service
User Offline
Joined: 19th Sep 2004
Location: Montreal
Posted: 18th Sep 2005 05:01
Ok i see your problem. First, your set object to follow need to be in the do...loop. Secondly, your second object position y(1) need to be change to object angle y(1). After your number (-15000,0,500,5) need to be change. Her the good code, put it in the main loop.



you cen ever change the number to whatever you like to be adjusted with the size of your model.

One last things, you don't need, in the load object command, to put all the directory. You can just put the model name with the .x .

hope it helped.

Windows XP,pentium IIII, 1,9 MGZ, 256 mb memory, 128 mb video card ATI Radeon 9200 se s80 'sett squadron back on the assault'
Galyxi
19
Years of Service
User Offline
Joined: 8th Sep 2005
Location: Using DBC
Posted: 24th Sep 2005 00:06
parameter mismatch. array must have at least one subscript

TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 24th Sep 2005 01:17
Try:

set CAMERA to follow object position x(1), object position y(1), object position z(1), object angle y(1), -20, 10, 1, 1

but like sett says, you don't use the command once - you put it in the main program Do..Loop or it won't work.

Also, when this command is being used, you cannot turn the camera to point in a different direction as the command includes where to point the camera.

TDK_Man

Me!
19
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 24th Sep 2005 15:13
or you could position the camera at the object, set it to the object orientation then pitch it down say 40degrees and move it back a distance, like this





to avoid the consequences of global warming, get into a car and join millions of other people in burning millions of gallons of fuel in a huge traffic jam.
WarGoat
20
Years of Service
User Offline
Joined: 19th Sep 2004
Location: Montreal
Posted: 24th Sep 2005 16:59
aaaa!! made a mistake in the command lol. Yeah TDK is right, its not set object to follow but set camera to follow. sry for the mistake again.

Windows XP,pentium IIII, 1,9 MGZ, 256 mb memory, 128 mb video card ATI Radeon 9200 se s80 'sett squadron back on the assault'

Login to post a reply

Server time is: 2024-09-24 05:30:03
Your offset time is: 2024-09-24 05:30:03