Game Development Community

World editor camera

by Konrad Carstein · in Torque Game Engine · 10/15/2007 (11:36 pm) · 6 replies

Hi all,

I've been working on a prototype for a simple game that uses a fixed top down camera view. Being new to Torque I was surprised to find that when using the world editor, I was under the same camera restraints as in the game. It would be very hard to create a mission stuck in a fixed top down view.

How is the editor related to the game exactly? Can I not keep the two pieces separate? I'd like to maintain the flexibility in the editor to move around, zoom and look at things from different angles, but of course that it totally different then the actual game controls.

Any help or assistance is greatly appreciated.

#1
10/16/2007 (12:55 am)
Have you tried pressing Alt-C to switch into FLY CAM mode? Assuming you haven't made any mods to break this.
#2
10/16/2007 (8:16 pm)
Yes, the Fly Cam mode no longer seems to function. The reason being I believe I removed the normal camera and replaced it with the Advanced Camera found in a tutorial.

Perhaps I need to renable the old camera and have both functioning? This is pretty new to me, so I may just need to spend some time on Camera 101.

I am curious though how changes to the game scripts are impacting the world editor.
#3
10/16/2007 (11:33 pm)
Ok, so I've been able to restore the orginal camera functions, including the Fly Cam. Also using the below, I can partially do what I'm trying to achieve. With the below code in commands.cs I can switch from the normal camera, to the fly out, and to my stationary "advanced" camera.

The problem is unlike the code below, I don't really want to make the advanced camera the control object, I want to keep the player the control object, but switch to that camera's "view". Giving the advanced camera control gives me the display from the correct camera, but I of course am unable to move the character.

How can I leave control with the player, but switch to different cameras?

function serverCmdToggleCamera(%client)
{
  
   %control = %client.getControlObject();
   if (%control == %client.player){
      %control = %client.camera; 
      %control.mode = toggleCameraFly;
   }else if(%control == %client.camera){
   
      %control = %client.advCamera;
   }else{
      %control = %client.player;
      %control.mode = observerFly;
   }
   %client.setControlObject(%control);
}
#4
10/17/2007 (4:15 am)
Heres what I used when I was using the advanced camera (since I have written my own camera). I use the same method with my own camera as well to allow Fly Cam.

function serverCmdToggleCamera(%client)
{
   %control = %client.getControlObject();
   %cameraObject = %client.getCameraObject();
   
   if (%control == %client.player)
   {
      %control = %client.camera;
      %control.mode = toggleCameraFly;
      %cameraObject = %client.camera;
   }
   else
   {
      %control = %client.player;
      %control.mode = observerFly;
      %cameraObject = %client.advCamera;
   }
   %client.setControlObject(%control);
   %client.setCameraObject(%cameraObject);
}
#5
10/17/2007 (6:48 pm)
Excellent! Thank you Brian. This is a matter of me learning the methods available to the objects.

One additional question though, what exactly does this do?

%control.mode = toggleCameraFly;

or

%control.mode = observerFly;

I can't seem to find any references to "toggleCameraFly" or "observerFly" anywhere in the scripts or in the engine code. Thank you so much for the help!
#6
10/18/2007 (4:37 pm)
Honestly I don't think they do anything. They are legacy statements that kept track of which mode the camera was in. I think we can safely remove them I just never got around to it.