Game Development Community

How To Get Camera Object And Position?

by suddysud aka mrclean · in Torque Game Engine · 01/27/2006 (8:53 am) · 3 replies

QUESTION 1:

How do I get and manipulate my Camera object the default one from the Console?

I want to be able to fly my camera to various spots but I can't figure out how to get the camera object.

I type Camera.getPosition(); and it can't find the Camera object.


QUESTION 2:

And while I'm at it I notice that in the world editor I can create a camera object.
After I do that how can I view the world through that camera object

I'm guessing I have to pass control to another object via getControllingObject()

Thanks in advance

#1
01/27/2006 (10:30 am)
Have you checked the scripts that run when you press F8?
Checked out game.cs where the player and camera is spawned, and the client given control of both?

That's what I can think of at the moment which pretty much is what you're after.
#2
01/27/2006 (1:18 pm)
Or take a look at the server side serverCmdToggleCamera script method, which gives the player complete control of their camera when they type alt-c.
#3
01/27/2006 (4:05 pm)
I see the Code but have a couple questions about it

function serverCmdToggleCamera(%client)
{
   %control = %client.getControlObject();
   if (%control == %client.player)
   {
      %control = %client.camera;
      %control.mode = toggleCameraFly;
   }
   else
   {
      %control = %client.player;
      %control.mode = observerFly;
   }
   %client.setControlObject(%control);
}


Thanks I've got it