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 / 3rd Person Camera

Author
Message
Still Remains
14
Years of Service
User Offline
Joined: 18th Jun 2009
Location:
Posted: 19th Jun 2009 03:11 Edited at: 19th Jun 2009 23:28
Ok so im pretty new to programming, I only have a one year course of using DB of experience but i just dled the DBC and i was trying to get my camera to follow the character in a 3rd person manner but i cant seem to figure out and ive tried all sorts of stuff. here's my code:

sync rate 60

rem Player Creation
make object cube 1,50
color object 1, rgb(155,0,155)

rem Level Creation
make object box 2,1000,10,1000
position object 2,0,-15,0
color object 2, rgb(0,255,0)

rem Declare Variables
MySpeed = 10
angle# = object angle y(1)
posx# = object position x(1)
posy# = object position y(1)
posz# = object position z(1)

rem Main Loop Begin
do

rem Player Movement
if upkey()=1 then move object 1,MySpeed
if downkey()=1 then move object 1,0-MySpeed
if rightkey()=1 then angle#=wrapvalue(angle#+5)
if leftkey()=1 then angle#=wrapvalue(angle#-5)
yrotate object 1,angle#

rem Camera Mechanics
point camera posx#,posy#,posz#
position camera posx#,posy#+100,posz#-250

rem Main Loop End
loop
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 19th Jun 2009 09:24
1) Please use code snippets. Highlight your code and click "code".

2) Try this:


TheComet


Make the path of your enemies easier with Waypoint Pro!
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 19th Jun 2009 16:28
heres a link to TDKs tutorial on set camera to follow:

http://forum.thegamecreators.com/?m=forum_view&t=123485&b=10

and heres one to TDKs list of tutorials, they are a great place to start if you're new to programming

http://forum.thegamecreators.com/?m=forum_view&t=99497&b=10

There are only 10 kinds of people in the world, those who understand binary and those who dont
Still Remains
14
Years of Service
User Offline
Joined: 18th Jun 2009
Location:
Posted: 19th Jun 2009 21:45
Alright TheComet, I tried your code and it does make the camera follow the cube but it won't move, the camera just sits in the middle of the level still
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 20th Jun 2009 10:26 Edited at: 20th Jun 2009 10:28
Maybe the camera is colliding with something... Try setting the last number behind the "set camera to follow" to 0.

Sorry, wasn't thinking.

Put this in your code right before the camera commands:



TheComet


Make the path of your enemies easier with Waypoint Pro!
Still Remains
14
Years of Service
User Offline
Joined: 18th Jun 2009
Location:
Posted: 20th Jun 2009 22:36
Ok so I don't have anything for the camera to collide with but I tried changing that last number anyways and it didn't change anything and I already got the variables set at the top of my code. Is there a way to keep the camera behind my object?
Thank you for all your help by the way.

Still.Remains
Still Remains
14
Years of Service
User Offline
Joined: 18th Jun 2009
Location:
Posted: 22nd Jun 2009 03:21
Nevermind I figured it out I did have to put the variables back in my do loop. Thank you

Still.Remains
arbiter chewbacca hybrid
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 27th Jun 2009 23:44
http://developer.thegamecreators.com/?f=t01/3d_tutorial_4


Vista is a paradox created by Bill Gates to force the noble pc gamers of america to console I am here to change that. [link]www.kdlproductions.webs.com[link]

Login to post a reply

Server time is: 2024-05-20 10:13:50
Your offset time is: 2024-05-20 10:13:50