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 / 3D platform game. Help with camera neede.

Author
Message
souled
20
Years of Service
User Offline
Joined: 3rd Feb 2004
Location: Greece, Athens
Posted: 18th Feb 2004 02:54
Hi super-coders!!!
I'm a bit confused on how to make a good camera tracking system.
I'm based on something like:
if player_position > stationary_camera_area
then camera_position = player_movement
Any ideas?
Indian Homie G
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: San Jose, CA
Posted: 18th Feb 2004 05:48
ok ... try this (by the way, i SUCK at darkbasic)
x# = object position x(the # of the object)
y# = object position y(same thing)
z# = object position z(same)
so far, u are just storing the coordinates...now heres the fun part

position camera x#-whatever u want,y#-same thing,z#-same

you can add something to x# or y# or z# it's not only minus... you put the position camera thing in your main loop, so this process is continually being repeated

i hope i made some sense
X_MEN
21
Years of Service
User Offline
Joined: 14th Sep 2003
Location:
Posted: 18th Feb 2004 17:26
`try this

do
cubeY#=Object angle Y(1)
x#=object position x(1)
y#=object position y(1)
z#=object position z(1)

if upkey()=1 or downkey()=1 or leftkey()=1 or rightkey()=1 then usercursor=1

if upkey()=1
x# = newxvalue(x#,wrapvalue(camera angle y()),1)
z# = newzvalue(z#,wrapvalue(camera angle y()),1)
endif
if downkey()=1
x# = newxvalue(x#,wrapvalue(camera angle y()-180),1)
z# = newzvalue(z#,wrapvalue(camera angle y()-180),1)
endif
if leftkey()=1
x# = newxvalue(x#,wrapvalue(camera angle y()-90),1)
z# = newzvalue(z#,wrapvalue(camera angle y()-90),1)
endif
if rightkey()=1
x#=newxvalue(x#,wrapvalue(camera angle y()+90),1)
z#=newzvalue(z#,wrapvalue(camera angle y()+90),1)
endif
y#=get ground height(1,y#,z#)+50
position object 1,x#,y#,z#

`camera commands
cx#=object position x(1)
cy#=object position y(1)
cz#=object position z(1)-150
camY#=camera angle Y()

distance#=150
backarea#=50



`player farer than camera
position camera cx#,cy#,cz#
` point camera x#,y#,z#
` yrotate camera camY#

ink RGB(0,230,100),RGB(0,0,0)
set cursor 0,0
print "playerx=",x#," point limit is ",x#-distance
print "playerz=",z#," point limit is ",z#-distance

sync
loop

You can do it if you try
souled
20
Years of Service
User Offline
Joined: 3rd Feb 2004
Location: Greece, Athens
Posted: 18th Feb 2004 23:08 Edited at: 18th Feb 2004 23:12
Thank you guys! It's all clear to me now. I came up with this solution
rem x# = player position x || cx#=camera position x#
if (x#-cx#)>distance# then cx#=x#-distance#
if -(x#-cx#)>distance# then cx#=x#-distance#
`the same for z#

There are some technical troubles though when player's position changes from negative to positive, I think it has to do with camera angle. I have to try hard or else I won't learn coding.
Indian Homie G
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: San Jose, CA
Posted: 18th Feb 2004 23:56
well ya mine works and so does xmen's, you didnt really specify exactly HOW you wanted it
i love that smiley

Login to post a reply

Server time is: 2024-09-21 20:37:58
Your offset time is: 2024-09-21 20:37:58