Game Development Community

Console evaluation context question

by Lars H Westergren · in Torque 3D Beginner · 10/12/2011 (9:12 am) · 0 replies

I'm just getting started and have a few questions. I've created a very simple level using the world editor, containing a single named object. Let's call it the DeathBall. I'm trying to make the camera orbit this object.

1) In core/scripts/server/camera.cs I've created the following function:
function serverCmdSetCameraPosition(%client)
{
   %client.camera.setOrbitObject(DeathBall, mDegToRad(60) @ " 0 0", 0.5, 10.0, 5.0, false);
}
If I start the world editor and pull down the console, can invoke the function with commandToServer('SetCameraPosition'); but get a "Camera::setOrbitObject - Invalid object" back. The console is clearly evaluating things in the server context, since DeathBall.getID(); works. So how do get the reference back to the client easiest, when running the game in the world editor?

2) I keep having to restart the World Editor for it to detect script changes. I understand you can reload them using exec('path'), but I can't find anywhere in the documentation what the default current path is! I get Invalid script file name with all paths I try.

Thanks,
Lars

About the author

Recent Threads