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 Professional Discussion / Following camera help!

Author
Message
Beyond the Humans Knowledge
15
Years of Service
User Offline
Joined: 27th Oct 2010
Location:
Posted: 29th Oct 2010 01:49
I figured out how to make the camera follow my person, but if you load the code, then you can obviously see that the camera angle isn't affected during the rotation of my block. Please, how do i make the camera rotate as my block rotates, i need to make the camera stay behind the block.

sync on
sync rate 60
make object cube 1,25
make light 1
set light range 1,90000
make object cube 2,25
load image "floor.png",2
make matrix 1,1000,1000,50,50
position matrix 1,0,-15,0
prepare matrix texture 1,2,1,1
do
texture object 2,2
position object 2,0,0,0
X=object position X(1)
Y=object position Y(1)
Z=object position Z(1)
position camera X,Y+50,Z-100
if rightkey()=1 then turn object right 1,3
if leftkey()=1 then turn object left 1,3
if upkey()=1 then move object 1,3
if downkey()=1 then move object 1,-3
sync
loop

onhcet d(-_-)b techno
Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 29th Oct 2010 15:38
You may want to look at the command

SET CAMERA TO FOLLOW

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 29th Oct 2010 16:50
And at the command

POINT CAMERA

TheComet

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 29th Oct 2010 17:20 Edited at: 29th Oct 2010 17:22


Beyond the Humans Knowledge
15
Years of Service
User Offline
Joined: 27th Oct 2010
Location:
Posted: 29th Oct 2010 21:28
I know the point camera command and the set camera to follow command, but i can't get them to work. Can someone show me an example?

onhcet d(-_-)b techno
Sixty Squares
20
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 30th Oct 2010 07:57 Edited at: 30th Oct 2010 08:06
Searching SET CAMERA TO FOLLOW brings up this:
Set Camera To Follow Tutorial

Another method could be this:
1) Position the camera where your object is.
2) Y Rotate the camera to your object's Y angle.
3) X Rotate the camera by some angle so it is looking down a little bit
4) Move the camera backwards by some distance using the MOVE CAMERA command. This will set how far away the camera is.
-The camera should follow your object at all times (it won't be as smooth as SET CAMERA TO FOLLOW though)

EDIT: Here is your code with that camera method added:


By the way, this:

Doesn't have to be in the loop. It only needs to happen once since object 2 isn't changing textures or moving anywhere.

I would recommend the SET CAMERA TO FOLLOW command though, it's much better and smoother


Guns, cinematics, stealth, items and more!

Login to post a reply

Server time is: 2026-07-22 04:37:59
Your offset time is: 2026-07-22 04:37:59