Setting a camera is not instant?

Scripting questions, discussions, etc
3 posts Page 1 of 1
irei1as
Posts: 76
Joined: Fri Feb 27, 2015 5:13 pm
by irei1as » Wed May 13, 2015 11:30 am
This TorqueScript code:

Code: Select all

function serverCmdorbitCam(%client) { %client.setFirstPerson(false); %client.setCameraObject(%client.camera); %client.setControlObject(%client.camera); //just in case %client.camera.setOrbitObject(%client.player, "0 0 " @ -mDegToRad(90), 15, 25, 25, false, "0 0 1", true); %client.setControlObject(%client.player); }
fails setting the camera with the correct angle.

While:

Code: Select all

function serverCmdorbitCam(%client) { %client.setFirstPerson(false); %client.setCameraObject(%client.camera); %client.setControlObject(%client.camera); //just in case %client.camera.setOrbitObject(%client.player, "0 0 " @ -mDegToRad(90), 15, 25, 25, false, "0 0 1", true); schedule(0, 0, commandToServer,'ctrlobj'); } function serverCmdctrlobj(%client) { %client.setControlObject(%client.player); }
works correctly.

(Note: using

Code: Select all

commandToServer('orbitCam');
just before the closing "}" of GameConnection::onClientEnterGame(%this) inside game.cs)

Well, can I change a non-player camera -OrbitObject this case- without having to rely on camera control? I guess I'm doing something wrong.
Or, is it possible to make the camera change be instantaneous so I don't have to worry about the client losing the player control?

If it's important: I'm using a very weak computer for this so if you tell me it works for you it may be just this low end machine. Sorry for the trouble.
rlranft
Posts: 298
Joined: Thu Feb 05, 2015 3:11 pm
 
by rlranft » Fri May 15, 2015 3:05 pm
Just a tip: Don't schedule anything for less than 32 ms. You will start getting random "no flux capacitor installed" asserts (except "not on my machine" because you are using a really slow computer - so "irritating crash that developer can't reproduce").

And why not set the control object first? It all should happen within the span of a tick or two - no one should notice a 32ms tickle....
irei1as
Posts: 76
Joined: Fri Feb 27, 2015 5:13 pm
by irei1as » Fri May 15, 2015 5:01 pm
Thanks for the tip. It's good to know.
And the idea of setting the schedule first sounds quite sweet.

Now I wonder if the error is related to http://forums.torque3d.org/viewtopic.php?t=12 . I'll have to check.
3 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest