Advanced Camera queston
by Harrison Brock · in Torque Game Engine · 04/17/2007 (4:19 pm) · 3 replies
I have the Advanced Camera set with a offset A. What I need is if press Key "L" is for the off set to change to (0,0,0);
I have been trying to do something like this:
function SideView(%this)
{
%this.advCamera.setThirdPersonOffset(0 0 0);
}
and
moveMap.bind( keyboard, L, SideView);
but this dose not work.
thanks for any help.
I have been trying to do something like this:
function SideView(%this)
{
%this.advCamera.setThirdPersonOffset(0 0 0);
}
and
moveMap.bind( keyboard, L, SideView);
but this dose not work.
thanks for any help.

Employee Michael Perry
ZombieShortbus
example\starter.fps\client\scripts\default.bind.cs:
moveMap.bind(keyboard, L, SideView); function SideView(%val) { if(%val) commandToServer('SwitchToSideView'); }example\starter.fps\server\scripts\commands.cs:
function serverCmdSwitchToSideView(%this) { %this.advCamera.setThirdPersonOffset("0 0 0"); }You can change the file paths to suit your own projects, but you'll want the first code block in a client side script, and the second code block in a server side script.
Now for the explanation: we both used the %this variable to access the advCamera member. The difference is, my function actually has this variable passed in with a value referencing the client containing the advCamera, where as your function is referencing either nothing or the function itself.
Whenever you call a commandToServer, the function being called automatically receives the %this pointer for the client, so you just have to code your serverCmdFunction to have the %this variable first.
Hope that clears up the confusion.