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 / First-Person Racing Game: camera doesn't rotate with car

Author
Message
Mike Schlueter
19
Years of Service
User Offline
Joined: 28th Nov 2005
Location: Somewhere that I\'m not suppose to be
Posted: 27th Oct 2009 20:58
I've tried to fix this problem, but it wont go away.

The car faces 0 degrees. Camera is in same direction as car. If I turn the car left or right 90 degrees, the camera turns with it. But when the turning exceeds 90 degrees either way from 0 degrees, the camera rotates the opposite way.

So with 180 degrees, the camera does what its suppose to do, but on the other 180 degrees, it does the opposite.

"rotate camera 0,object angle y(1),0" Is the line i've used to figure this out. I've used "wrapvalue", but with still the same result. I've also looked in the command help file for all the rotation commands and still the exact same thing happens.

Please help, i've gotten such a headache trying to figure out this possibly simple problem.

Thanks in advance,
Mike

"Our destination may define us, but it's what we do along the way that makes us who we are."
-MTS
Novaguy
16
Years of Service
User Offline
Joined: 1st Apr 2009
Location:
Posted: 27th Oct 2009 21:21
Try using this:
rotate camera 0,object angle x(1),object angle y(1),object angle z(1)
or
set camera to object orientation 1 `I don't prefer this method personally

Euler angles are kind of funny in DBPro, sometimes in inexplicable ways. If this doesn't work, post your code.
Mike Schlueter
19
Years of Service
User Offline
Joined: 28th Nov 2005
Location: Somewhere that I\'m not suppose to be
Posted: 29th Oct 2009 17:35
Ya "rotate camera 0,object angle x(1),object angle y(1),object angle z(1)" did it. it works now thanks.

"Our destination may define us, but it's what we do along the way that makes us who we are."
-MTS
Mike Schlueter
19
Years of Service
User Offline
Joined: 28th Nov 2005
Location: Somewhere that I\'m not suppose to be
Posted: 29th Oct 2009 17:49
I take that back.

I added a quick mouse look feature:

rotate camera 0,object angle x(1)+(mousey()/2),object angle y(1)+(mousex()/2),object angle z(1)

It works, but every few seconds the screen "jumps" or shakes. Plus for 180 degrees the camera moves with the mouse, and with the other 180, it moves opposite of the mouse. Up is down, left is right. :S

"Our destination may define us, but it's what we do along the way that makes us who we are."
-MTS
Mike Schlueter
19
Years of Service
User Offline
Joined: 28th Nov 2005
Location: Somewhere that I\'m not suppose to be
Posted: 29th Oct 2009 18:08
K I think I know what the "jumping" is. when the cart rotates(I think 180 degrees) the camera rotates 90 degrees along the y axis.

I rewote the mouse look code. still having the jumps and 180 opposite problem, but it's smoother:


rotate camera 0,object angle x(1)+my#/4,object angle y(1)+mx#/4,object angle z(1)

mx#=mx#+mousemovex()
my#=my#+mousemovey()


P.S. I'm using the 'turn object' command for the cart. I don't think that would be the cause though.

"Our destination may define us, but it's what we do along the way that makes us who we are."
-MTS
Drew Cameron
21
Years of Service
User Offline
Joined: 30th Jan 2004
Location: Scotland
Posted: 29th Oct 2009 19:45
I hate to patronise...but, try this code out;



Didn't test the above but it should work. What's the problem here? Sounds like you are just rotating the camera in the same way of the cart instead of having the camera orbit the object and point at it at all times...

Mike Schlueter
19
Years of Service
User Offline
Joined: 28th Nov 2005
Location: Somewhere that I\'m not suppose to be
Posted: 29th Oct 2009 22:44
What I'm trying to aim for is you're driving this cart around, and the camera is where your head would go, hence the "first-person". You can look around while driving.

My problem is that for 180 degrees of the angle that the cart is on, the camera rotates opposite of the mouse. I move the mouse left, camera turns to the right.

"Our destination may define us, but it's what we do along the way that makes us who we are."
-MTS
Novaguy
16
Years of Service
User Offline
Joined: 1st Apr 2009
Location:
Posted: 29th Oct 2009 22:55
Take what you want from this



Cube is looking at a sphere, camera is on the cube. Left and right arrow keys to turn the cube left and right, mouse to look around. Is this what you need?
BowserYo
17
Years of Service
User Offline
Joined: 4th Jan 2008
Location:
Posted: 29th Oct 2009 23:02
I have the exact same problem but with newton, I don't think it is your methed of rotation...

Seems like my car's Y angle can only range from +90 to -90. If you figure this out please post it up here!

ßõw§€r¥¤
Novaguy
16
Years of Service
User Offline
Joined: 1st Apr 2009
Location:
Posted: 29th Oct 2009 23:18
OHHHHH I get what you guys are talking about. DBPro global angles are kind of messed up in some cases. Make a quick program that rotates an object according to key commands, and have it print the object's angles. You'll notice they get messed up at certain points. I'd make one to show you guys but I'm short on time. It's messy, but try EZ_RO and you may have better luck. Otherwise, you gotta stick with pitch/roll/turn commands to get consistency.
Mike Schlueter
19
Years of Service
User Offline
Joined: 28th Nov 2005
Location: Somewhere that I\'m not suppose to be
Posted: 29th Oct 2009 23:52
Thats weird. goes from 0 to 90 to 0 then -0 to -90 to -0. I thought it'd go to 180 atleast.

That would explain the opposite y rotation for half the turning angle, its negative.

Well with that understood, I've run into another problem that I'll make another thread for.

"Our destination may define us, but it's what we do along the way that makes us who we are."
-MTS

Login to post a reply

Server time is: 2025-05-21 05:06:34
Your offset time is: 2025-05-21 05:06:34