How should I find the %client of a camera ?
by Vis · in Torque Game Engine · 11/20/2008 (7:42 am) · 3 replies
I am using the pathedCamera resource.
In GameConnection::onClientEnterGame() I set up a pathed camera thus;
I have created a script callback onTarget() that gets called when the camera arrives at the end of the path and I want to send a command to the client that owns the camera, I found this works :-
Is this the correct approach ?
or is there a method something like:
%cl = %camera.getThisCamerasClientID()
In GameConnection::onClientEnterGame() I set up a pathed camera thus;
%this.PathCamera = new PathCamera() {
dataBlock = LoopingCam;
position = "0 0 300 1 0 0 0";
};
%this.PathCamera.followPath("MissionGroup/Paths/PathOne");
MissionCleanup.add( %this.PathCamera);
%this.PathCamera.scopeToClient(%this);
$Server::Client = %this;
%this.setControlObject(%this.PathCamera);I have created a script callback onTarget() that gets called when the camera arrives at the end of the path and I want to send a command to the client that owns the camera, I found this works :-
function LoopingCam::onTarget(%this,%camera){
for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ ) {
%cl = ClientGroup.getObject( %clientIndex );
if(%cl.getCameraObject() == %camera)
{
commandToClient(%cl,'DisplayLogin');
break;
}
}
}Is this the correct approach ?
or is there a method something like:
%cl = %camera.getThisCamerasClientID()
Associate Konrad Kiss
Bitgap Games
%this.PathCamera = new PathCamera() { dataBlock = LoopingCam; position = "0 0 300 1 0 0 0"; }; %this.PathCamera.client = %this;... and get it right from the camera when you need it:
function LoopingCam::onTarget(%this,%camera) { %client = %camera.client; }