Advertisement

RTS type Camera

Started by April 01, 2004 12:46 AM
2 comments, last by Hades11 20 years, 11 months ago
I''ve searched for this and couldnt quite get the answear I was looking for so excuse me if this has been asked before. My question is for a map editor im in the process of writing. I''ve noticed in some world/map editors and in some rts games that regardless of how the camera is rotated if you press the up or down arrow keys that (from a top down perspective) it moves forward/backward. My camera is pretty simple so when I hit the up/down keys it increments the y position of the camera so when im looking top down on the map it will move forward/backward, but when im looking at it straight on it will move the camera up. From what i''m reading I hear things like "up vector". Is this the way to achieve the effect im talking about? And if so how exactly or is it something else? Thanks in advance for your help =) -- Ah but you very well mean you can''t take less, it''s very easy to take more than nothing.''
--Ah but you very well mean you can't take less, it's very easy to take more than nothing.'
WEll it depends on a few things.
If your map up vector is +y(default in ogl) and you just rotate the camera down then if you increment y then it goes up.

Other map editors use +z as upvector wich means that the camera doesn''t have to be rotated, and if you increment y then you move forward in the map.

try incrementing z instead of y.

---------------------------------
For an overdose of l33tness, flashbang.nu
Advertisement
Thanks but im back to the same problem because when i rotate the camera to a top-down view it zooms towards the map and not "up". Basicly what I want to achieve is that no matter how my camera is roated that I can move "up" (from a top down perspective). Is there some way to have the camera up vector pointing always in the +z direction?
--Ah but you very well mean you can't take less, it's very easy to take more than nothing.'
I think you didn''t get what the Up Vector is:
if you''re facing a point from a certain position, you may want to turn the camera up-down, as if you were no more standing on your feet, but on your hands. The UpVector wouldn''t be (0,1,0) anymore, but (0,-1,0).
As you see this does not affect the direction you''re facing or the point you''re standing.

I think that what you''re trying to do is easier than you think.
Actually, if the camera moves forward and not just up, it means you''re not just increasing (or decreasing) the X and Z values, but you''re changing the Y value as well.
I guess you''re using an algorythm (damn spelling) you dind''t wrote by yourself, and which is way more complicated than the one you need. You may simply need to delete those lines where the Y value is changed, so that the camera simply moves North, South, East and West.

Sorry for having written such a long uncomprehensible explanation.

This topic is closed to new replies.

Advertisement