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 / Calamity camera!

Author
Message
Sonic 91 Software
21
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 14th Nov 2006 23:45
I am coding a top-down driving game and i want the camera to follow the position of the player object up and down, left and right. but when i do this:



it rotates the camera left and right when the player turns left and right and when i press down, it immediately y-rotates the camera 180 deg. What's going on?

p.s. if i set the camera position in the above loop to "position camera ox#,50,oz#-20", I don't have this problem and the camera follows the object as it is supposed to.

"Fight the good fight of faith,
Lay hold on eternal life"
-1 Timothy 6:12
Krilik
20
Years of Service
User Offline
Joined: 16th Mar 2006
Location: Arizona, USA
Posted: 15th Nov 2006 05:44
I'm not sure exactly what you mean, but the code you provided doesn't really work the way you described. There is an error in the code for one, turn object player left,1 and turn object player right,1 should be turn object left player,1 and turn object right player,1. The camera wouldn't rotate the way you described, both how it was supposed to, and how you didn't want it to. Maybe there is something in the rest of your code that is causing it to do that.

Anyway, I wrote a little demo to show you how it can be done without problems. Instead of using the turn object commands you should just increase and decrease an angle value to rotate your object. Then just use that angle to position your camera along with your player coordinates. Here is a demo showing you how it works:


Sonic 91 Software
21
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 15th Nov 2006 08:34


oops, that's what I meant. thanks, krilik, but is there any way of doing that with the "turn object" commands, rather than angle#?

"Fight the good fight of faith,
Lay hold on eternal life"
-1 Timothy 6:12
Krilik
20
Years of Service
User Offline
Joined: 16th Mar 2006
Location: Arizona, USA
Posted: 15th Nov 2006 22:27
You can, I never like to though because it causes the object orientation and camera orientation to mess up later.

What you could do is set your camera to look down at the object before you main loop, and then just use the roll camera command along with turn object command when you press left or right.

So something like: (I don't know if this will work, I'm at school right now so I can't test it)



Of course if you manipulate the camera rotation it will cause problems later on. That's why I like to use the other method I posted.
Sonic 91 Software
21
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 16th Nov 2006 00:08
took a bit offiddling around with, getting it all into the right place, but your first method with angle# and wrapvalue worked. thank you, krilik.

"Fight the good fight of faith,
Lay hold on eternal life"
-1 Timothy 6:12

Login to post a reply

Server time is: 2026-07-06 23:43:29
Your offset time is: 2026-07-06 23:43:29