Game Development Community

Top down camera mode

by William Urban · in Torque Game Engine · 05/05/2005 (4:15 pm) · 4 replies

Pretty new to the whole engine so pardon some of my questions. I tried searching resources and forum threads but was having a hard time finding exactly what I want to do. So basically I am looking to find where I set the camera position and look at. I have used directX before so thats all I really know. Basically in directX you say the camera is located at x,y,z and looking at x,y, z so for a top down view in the fps demo i'm looking for something like (located playerx, playerz, +30 ft above player) looking at playerx,playerz, 0 kind of thing. Maybe I am just way off on how the camera works.

I just want a top down view, kind of like 3rd person but directly overhead. Also, is the camera in 1st person what dictates the angle that the projectile is fired at? I notice that in 3rd person you really cant aim well. Is there a way to do 3rd person over the shoulder and have a crosshair to aim with?

Thanks for any help,

Will

#1
05/05/2005 (8:37 pm)
I found a few advanced camera classes but is there something that can be done in the scripting or just the C++ code itself to hard code the variables I want for the camera location and camera look at? I'm still trying to wrap my head around the fact that the camera info gets sent across the multiplayer connection *boggle* so confused.

-Will
#2
05/06/2005 (1:03 am)
Stock camera you have camera nodes inside the player model - eye and cam. You're more or less stuck with those unless you hack the engine. You can naturally in your modeller move those nodes around

Several resources exist (as you've found) that enable control of the camera using a camera object. Using those you can do exactly what you are looking for. E.g. see the third person mode or god view mode of the advanced camera resource. It uses a (script exposed) lookat offset (point to look at relative to the player) and a third person offset (camera placement relative to the player)

Using the lookat and thirdperson offsets you can quite easily move the camera around - e.g. to a over the should view.

3rd person crosshairs that are accurate on the other hand are not easy. You need to rethink the entire way the player weapons are controlled. There are a few threads on that already on the forums.
#3
05/06/2005 (9:15 pm)
Ok I added all the resources for the advanced camera. I am having trouble actually implementing it though. When it says add it to the project, is there somewhere I have to do a # include so that it compiles in properly or just being in the folder will be ok when it does a make all?

Then after that part, how do I actually switch the modes. I tried putting it in place of the tab for 3rd person POV but that didn't work, where do I call the %this.advCamera.setOrbitMode() from?

I have the RTS kit as well, should I (or is it possible) to take the RTS camera object and just plop it down? Thanks for any help.

-Will
#4
05/07/2005 (12:30 am)
Add it to the project: copy the files into your source tree somewhere, and then right click on your project tree view folders, add, existing files.., point to the new files and recompile

%this is the client connection. So if its a single player game your can say LocalClientConnection.advCamera.setOrbitMode() in the console

Else you can wrap that into a server side command, where you get the client connection as the first argument

function serverCmdSwitchOrbit(%client)
{
%client.advCamera.setOrbitMode();
}

And then call that server command from the client code on e.g. keypress or on startup in the playGui.cs