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 / Trouble with dbPointCamera

Author
Message
Ifandbut
15
Years of Service
User Offline
Joined: 8th Jan 2009
Location:
Posted: 12th Jan 2009 05:14
I'm just starting with DarkGDK and currently all I want to do is load a object, move the camera and have the camera point to it. I saw the dbPointCamera function in the help file. I use it and the code compiles it however I allways have to adjust the view with the mouse, it feels like the point camera function is not working as intended or I have no clue how to use it (however it appears fairly strait forward).

Here is my code. Most of it is from the Game Level tutorial because it already had the camera movement code done for me. It loads a 1x1x1 cube I made in 3DS Max and exported to .X format. Then it sets the object to 1,1,1 and camera to 10,10,10.


Thanks for any help. It's likely a simple fix but I'v just banged my head agenst the wall for the past 2hrs trying to get this to work.
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 12th Jan 2009 10:59 Edited at: 12th Jan 2009 11:00
If you want the camera to always point at the object put:

in the main loop.
This way it will update the camera every frame to keep it pointing at object.

The other problem you have is that this code:

will change the way the camera is pointing and contradict dbPointCamera function.
So its one or the other depending on what you want.
Ifandbut
15
Years of Service
User Offline
Joined: 8th Jan 2009
Location:
Posted: 12th Jan 2009 19:06
DOH!
I knew it was something simple. Having fCameraAngleX/Y being set to 0 then rotating the camera AFTER I did point camera would completely undo my point camera.

I'm at work atm so I dont have a command list with me, but I see that I need to set fCameraAngleX/Y to current camera angle X/Y after I point the camera but before the main loop. This way the camera will start by looking at the object but I'll still be able to move it useing the mouse.
Ifandbut
15
Years of Service
User Offline
Joined: 8th Jan 2009
Location:
Posted: 13th Jan 2009 02:18
OK, the plot thickens. I changed it so the initial camera rotation values were defined as the current camera rotation values before the main loop. Everything works fine. I wanted to disable the mouse control of the camera so I can use the arrow keys to "zoom" into the object.

I noticed another strange thing. I removed the dbRotateCameraX/Y instructions to limit to keyboard commands via dbControlCameraUsingArrowKeys. I am noticing that the camera does not tilt down or up (rotate on X I believe) unless I include a dbPointCamera command in the main loop. Does the dbControlCameraUsingArrowKeys overwrite the up/down tilt value that was set outside the main loop?

My code for this is:


The documentation on the dbControlCameraUsingArrowKeys says nothing about the command overwriting certain camera control values and not others. I assumed anything it would only overwrite the left/right rotate values not up/down.

Login to post a reply

Server time is: 2024-11-25 11:45:59
Your offset time is: 2024-11-25 11:45:59