Game Development Community

RTS Prototype/Tutorial: Camera

by Simon Sirius · in Torque 3D Beginner · 02/20/2013 (9:14 am) · 2 replies

Hi,
i am checking out the RTS Tutorial, but I cannot even get the camera to behave correctly:

I appended to commands.cs


function serverCmdorbitCam(%client)
{
%client.camera.setOrbitObject(%client.player, mDegToRad(20) @ "0 0", 0, 5.5, 5.5);
%client.camera.camDist = 5.5;
%client.camera.controlMode = "OrbitObject";
}



But when I call it on the console with
commandToServer('orbitCam');
The camera is not changing away from FPS view.
No errors are output and I am sure that the function is called.
What am I doing wrong?

#1
02/20/2013 (9:33 am)
To help troubleshoot, set up your function like this:
function serverCmdorbitCam(%client)
{
echo(" @@@ Client ID: " @ %client @ " :: Player Object ID" @ %client.player);
%client.camera.setOrbitObject(%client.player, mDegToRad(20) @ "0 0", 0, 5.5, 5.5);
%client.camera.camDist = 5.5;
%client.camera.controlMode = "OrbitObject";
}

This way you can be certain that the function is being called correctly and that the client is being passed properly.

Also, ensure that you have made the changes to scripts/server/gameCore.cs in GameCore::spawnPlayer() that are outlined in the RTS Prototype....

This is a relatively complex "tutorial" and strict attention to detail is required.
#2
02/20/2013 (2:24 pm)
alright thanks. setting up a camera is pretty much one of the most
basic things you can do for a game imo.

unlike in the rts prototype, I want the player control to stay
clientside:
so i cannot change the camera because of
%client.setControlObject(%control);
and the client switches to FPS via setFirstPerson(1).
I am avoiding it with:
%client.setFirstPerson(0);
in the preparePlayer now, though I am not sure, if the full template is really apropriate for a custom game idea.