Game Development Community

Camera / Observer

by Xavier "eXoDuS" Amado · in Torque Game Engine · 02/03/2002 (9:38 am) · 4 replies

I was looking a way to make an observer mode and i thought that adding to the GameConnection::onClientEnterGame() this:

%this.camera.setTransform(%client.player.getEyeTransform());
%this.camera.setVelocity("0 0 0");
%this.setControlObject(%client.camera);

that would make a pretty nice observer, but... i need to get the eye Transform from somewhere.. the code i pasted (which is used in the dropCameraatPlayr) gets the eye transform from the player, but in my case i wont have a player created, how could i add an Observer object or something in the game, which i would add using the editor, and get the EyeTransform from that?

#1
02/03/2002 (9:42 am)
Exo, there's a observer node in the editor isnt there? I think it was one of the market types.

Phil.
#2
02/03/2002 (10:02 am)
no, theres no observer node phil :\

tho i found the answer tho
:)
it was simple, well pickSpawnPoints returns a transform matrix, so i just did a similar func pickObserverPoints and added a ObserverDropPoints SimGroup to my mission with some spawnspheres in it.. and that's all :)
magic
lol
Cya!
#3
02/03/2002 (10:06 am)
Weird, I always thought there was an observer marker which basically did the same thing.. never mind tho.. both work :)

Phil.
#4
09/13/2002 (7:18 am)
check this code it's work perfectly. and validation code on some of your methode and it's work as you need (sorry for my poor english)


//-------------------------------------
//Sample : Create observer
function GameConnection::createObserver(%this, %spawnPoint)
{
// Create the player object
%player = new Player()
{
dataBlock = LightMaleHumanArmor;
client = %this;
};
MissionCleanup.add(%player);

// Update the camera to start at %spawnPoint
%this.camera.setTransform(%spawnPoint);

// Give the client control of the camera
%this.player = %player;
%this.setControlObject(%this.camera);
}