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.

DarkBASIC Discussion / Is there a SET CAM TO FOLLOW command in DBClassic?

Author
Message
mhack
23
Years of Service
User Offline
Joined: 24th Apr 2003
Location:
Posted: 27th Apr 2003 20:29
Thanks guys..
Kentaree
23
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 27th Apr 2003 20:55
Yea, and its also called set camera to follow.Its syntax is:



Where X,Y & Z are the coordinates it is following, angle is what angle its facing at, Camdist is the distance the camera is away from the object, Camheight is the height the camera is at, Camsmooth is how smoothly the camera moves at when following the coordinates and if Colflag is set to 1, collision to static collision boxes will be detected.

Whatever I did I didn't do it!
mhack
23
Years of Service
User Offline
Joined: 24th Apr 2003
Location:
Posted: 27th Apr 2003 21:56
I just tried

SET CAMERA TO FOLLOW 10, 10, 100, 30, 10, 1, 1, 0

and it says SYNTAX ERROR. UNKOWN COMMAND

BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 27th Apr 2003 22:29 Edited at: 27th Apr 2003 22:31
U all patched up? 1.13 is the latest.

Works fine for me.

By the way, I always follow this command with a POINT CAMERA. This gets around a few problems.

Thanks in advance.
All the Best,
StevieVee
Whisper Wind
23
Years of Service
User Offline
Joined: 5th Apr 2003
Location:
Posted: 27th Apr 2003 22:34
If that command does not exist, just create a function for it! I have included a function and a test code for it in the source code box and it works, but it is in DBPro. It is fully commented, so it will hopefully help you to understand how to do it.
Whisper Wind
23
Years of Service
User Offline
Joined: 5th Apr 2003
Location:
Posted: 27th Apr 2003 22:34 Edited at: 27th Apr 2003 22:34
oops you beat me to it
mhack
23
Years of Service
User Offline
Joined: 24th Apr 2003
Location:
Posted: 28th Apr 2003 03:58
Thanks guys.. first of all, I remember that when I bought my DB SET CAMERA TO FOLLOW was atleast in the help, now it's gone even there.

I downloaded patches for 1.13 and installed them.

Now, my help shows this command and I can use it.

I'm trying to follow an object that is flying thrugh 3d space, how is SET CAMERA TO FOLLOW works, it asks for ANGLE? what angle is that X, Y or Z angle? Also height? is that Y distance from 0,0,0 or what?

I tried this code you posted, and it says in SETCAM function declared with different parameters than it's called with?

Thanks..

Whisper Wind
23
Years of Service
User Offline
Joined: 5th Apr 2003
Location:
Posted: 28th Apr 2003 05:09
Thats wierd, are you using DB Classic? Because this was written in Pro, that may be the problem.
mhack
23
Years of Service
User Offline
Joined: 24th Apr 2003
Location:
Posted: 28th Apr 2003 18:59
Yeah I'm on classic..
I got DBPro demo and your source worked there..
I understand how to do a camera following object, but how about camera following it with delay like on that sliding demo with green steps but only in 3D?

BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 28th Apr 2003 20:45
SET CAMERA TO FOLLOW is very unpredicatable. Always follow with POINT CAMERA for the same X, Y and Z coordinates.

It doesn't work very well if the object is travelling towards you.

The angle is perpendicular to the world Y axis, in other words, it will rotate the camera around the object as if it was sat on the ground if you change it.

Mess around with the values until you get it right. The delay is very difficult to get just right, but changing it will produce all sorts of different effects. I have it set to 25, and it zooms out from where it is and then back in again, when following a moving object.

Thanks in advance.
All the Best,
StevieVee
mhack
23
Years of Service
User Offline
Joined: 24th Apr 2003
Location:
Posted: 28th Apr 2003 21:34
Thanks for info, now atleast I know what angle they meant

But if you will follow with point camera, it will negate any effect from follow isn't it?

Danmatsuma
23
Years of Service
User Offline
Joined: 2nd Mar 2003
Location: Australia
Posted: 1st May 2003 19:58
I wouldn't use point camera after set camera to follow, just use something like xrotate camera to point the thing up or down at your object, and dont make the 'camfade' variable too high. This way you get a nice smooth moving camera which lets your object drift to the left/right/up/down of the screen on direction changes. Set the fade value too high and you can lose the object for a while offscreen
and yeah, generally use the y angle of the tracked object as the angle variable, although, I left the angle variable at 0.0 for my retro entry BombKid http://www.darkbasicpro.com/rr.php?i=83 So the camera would act more 2d.

ZX Spectrum 48k Issue 3, Radio shack Tape drive, Rank arena 12" T.V. set.
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 1st May 2003 21:11
I use POINT CAMERA so that I get the movement of the camera, with the delay, but ensure the camera is always looking directly at the object. If you increase the delay, as Danmatsuma says, you'll lose the object momentarily. With my method, the camera will lag behind position wise, but still be watching the object shooting off into the distance.

Why do you use ROTATE, danmatsuma? There will be more maths involved, but do you get a better effect?

Thanks in advance.
All the Best,
StevieVee
Danmatsuma
23
Years of Service
User Offline
Joined: 2nd Mar 2003
Location: Australia
Posted: 1st May 2003 21:31
No, when you think about it it's less processing involved than using point camera.
In the end it's a personal preference thing, I like the drift, but if I have the camera positioned higher than the object, I'm effectively shooting over the top of it, though my camera is tracking it. If I rotate the camera say 20 degrees down, I'm once again pointing at the object, and following it. The xrotate command can be before the loop, so it's actually less processing going on.

To demonstrate this, go to the sliding collision example, take the line that reads: 'xrotate camera 15'
and place it before the do loop.

It remains rotated, without having to be processed every time.
I used to do what you suggest, and use point camera, but it really is quite processor hungry compared to the above method.

ZX Spectrum 48k Issue 3, Radio shack Tape drive, Rank arena 12" T.V. set.

Login to post a reply

Server time is: 2026-06-12 06:56:50
Your offset time is: 2026-06-12 06:56:50