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.

Dark GDK / Turn/Roll Camera problem/bug?

Author
Message
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 27th Aug 2009 22:33
If you have some code with camera control functions, try adding this anywhere in the loop:



It doesn't allow the camera past 180 degress, can anyone test their code to see if it is actually a problem with my code or with DGDK?


Your signature has been erased by a mod
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 28th Aug 2009 00:51 Edited at: 28th Aug 2009 00:52
I think maybe you are using the command incorrectly ? It works for me, here is the code I used, it turns the camera around and around, over and over, if you get it to display the cam angle, you will see.....



The function dbTurnCameraRight() is an overloaded function, its def is as follows :

void dbTurnCameraRight(float fAngle);
void dbTurnCameraRight(int iID, float fAngle);

The way its used it to either pass it the camera to turn(or it will affect the current default camera otherwise, usually cam 0), and then pass it the angle that you want it to turn....

In my above code, each loop, im asking camera 0 to turn 2 deg to the right, over and over, and it does, so im not sure what you did wrong in your code...

EDIT : All of the "dbTurnCameraXXX" command work in a similar manner

If it ain't broke.... DONT FIX IT !!!
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 28th Aug 2009 01:15 Edited at: 28th Aug 2009 01:17
When I move my camera using this: it locks at 180 degress and 0 degress



Why would there be any reason for it doing that?


Your signature has been erased by a mod
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 28th Aug 2009 01:24 Edited at: 28th Aug 2009 01:40
Your dbRollCameraRight command isnt doing anything, its rolling it 0 degrees, its a float though, so it may actually be moving something like 0.001 deg each loop even if you pass 0, I dont know if GDK casts the value or just lets the compiler do it or what... but I would stik a variable in there, and initialize it when you declare it, just to be safe.

I really cant think of why they would be locking like that, they dont for me.... I use the rotate commands above in most of my "debug camera movement" for apps and I generaly have to add in conditionals to stop it from looping over and over...

The only thing I can think of is that I am using gdk 7.4, what version are you using ? Im also using the directX march09 SDK, but i dont think that would make a difference.

EDIT : Had another idea, are you using those commands together ? is that when it displays the locking behaviour your seeing ? Just asking that , as I remember that I had some problems with the camera not being able to be affected properly with eular rotation when you are using the free-flight turn commands... ( dbTurnCameraXX commands use local co-ords to rotate around, but it does so by making internal calculations and setting the angles, where the rotate commands just pass in the angles in world space, so you need to be careful if you are using both the commands together.... kind of)

If it ain't broke.... DONT FIX IT !!!
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 28th Aug 2009 01:39 Edited at: 28th Aug 2009 01:39
It happens whether I use 0 degrees or not, what it does is the rotation works until you reach roughly 180 degrees and then it keeps jumping around and rotating to 0 degrees and it is weird. edit: using dgdk 7.4 not sure what sdk I'll check


Your signature has been erased by a mod
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 28th Aug 2009 01:56 Edited at: 28th Aug 2009 02:07
I notice you are using the "rotate" commands along with the "roll, turn, pitch" commands. I think these two types of rotation are incompatable.

The "roll etc" is free motion rotation while "rotate" is not.
I think you need to use one system or the other, if you are using roll then I presume you need free motion rotation so get rid of the rotate commands and replace them with turn and pitch, see if that helps.

EDIT: Just noticed Mista Milsons edit, hey Wilson, stop helping people all the time lol.
Just kidding, everyone appreciates all the help you give around here, keep it up.
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 28th Aug 2009 02:05
If I use the free motion one, I can't rotate my cam along an axis (so if you look up and then left or right, it is the left right of the camera and you face the ground vertically :\) but if I use axis rotation, I can't roll my camera Its a lose-lose situation


Your signature has been erased by a mod
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 28th Aug 2009 02:13 Edited at: 28th Aug 2009 02:16
There are a couple of commands:

dbSetcameraRotationXYZ()
dbSetCameraRotationZXY()

Have you looked at those, I have never tried them but they might help. I thought I read somewhere that they let you go between both systems but now I cant find it so it might be that they are completely unrelated to your problem.


EDIT: What kind of camera movement are you after? is it a flight sim etc..
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 28th Aug 2009 02:20
Its an FPS (the rolling is the slight camera roll when walking, think of Quake 3 Arena), I guess the "both systems" for those commands are the axes rotation orders :S


Your signature has been erased by a mod
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 28th Aug 2009 07:06
The freeflight functions rotate the rotation matrix of the camera directly and then extract the Euler angles from this, however there are multiple ways to represent each rotation and the extraction method is just returning a different one, thus in this case you're experiencing gimbal lock.

To fix this you should store the x/y rotations of the camera yourself and not get them via dbCameraAngleX/Y then pass them to dbRotateCamera, then assuming you want to implement some kind of lean functionality then add dbRollCameraRight() after you set the rotation and keep doing this every loop.

prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 28th Aug 2009 11:53
Dark coder: I fixed it thanks to you! Now I don't use the angleX and Y functions I just add the variable which stores the total mousemove x and y, which allows me to roll the camera now Thanks a bunch


Your signature has been erased by a mod

Login to post a reply

Server time is: 2024-11-20 17:30:26
Your offset time is: 2024-11-20 17:30:26