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?
%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?
About the author
#2
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!
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
Phil.
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
//-------------------------------------
//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);
}
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);
}
Torque 3D Owner Phil Carlisle
Phil.