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 / Help With The Camera

Author
Message
negi
13
Years of Service
User Offline
Joined: 16th Feb 2011
Location:
Posted: 18th Aug 2011 04:59
I am trying to make a game that has the same kind of camera as Command And Conquer but I can't seem to get the camera to point at the ground and move indipendintly of the way it's facing can anyone help?

All is revealed with time.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 18th Aug 2011 15:33 Edited at: 18th Aug 2011 15:35
well just change the object x and z and leave the y, and don't change rotation, for example:


that will move on the X axis when 'up' is pressed, without changing the camera direction

one more option, which is better (since you can press 'up' and move backwards in case the camera is in opposite direction), is to take camera angle and move according to it, for example:


note that camera rotation Z (i.e dbRollCamera) shouldn't be altered, it must be 0

and one final thing: this is not tested, please let me know if you get any errors, and also there are a lot of ways not only this, find the one that suits you

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 18th Aug 2011 15:42 Edited at: 18th Aug 2011 15:45
Not familiar with Command and Conquer... I think it points the camera from an overhead position at a spot on the ground and you can rotate around that point and zoom in and out...? You don't want to "orbit", you just want to "rotate"....? If that's the case, I have a solution:
make some globals:
And now the function:


Hope this helps.

The fastest code is the code never written.
negi
13
Years of Service
User Offline
Joined: 16th Feb 2011
Location:
Posted: 19th Aug 2011 02:01
The camera doesn't need to rotate accually it can't, I need the camera to look down and move forward, backward, left, and right. kind of like being in a heliocopter looking out and moving forward.




But thanks for the suggestions.

All is revealed with time.
negi
13
Years of Service
User Offline
Joined: 16th Feb 2011
Location:
Posted: 19th Aug 2011 03:04
Ok I kind of figured it out I got the camera to move forward and backward but it wont go left or right.

here is the code




can anyone tell me what I did wrong?

All is revealed with time.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 19th Aug 2011 06:02
This part of your code is not needed:

If you declared the camera's position using CameraX,CameraY,CameraZ earlier in your program, you don't need to tell those variables they are for the camera....
I can't tell if you did anything wrong exactly.... The snippet you showed may not contain the problem.

The fastest code is the code never written.
negi
13
Years of Service
User Offline
Joined: 16th Feb 2011
Location:
Posted: 19th Aug 2011 09:00
Ok then here is the complete code listing.



All is revealed with time.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 19th Aug 2011 15:26
You have some inconsistant code:

I've modified it:

I think that will work better.

The fastest code is the code never written.

Login to post a reply

Server time is: 2024-11-19 08:39:07
Your offset time is: 2024-11-19 08:39:07