Jump to content

Setting a camera is not instant?


irei1as

Recommended Posts

This TorqueScript code:

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:

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

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.

Link to comment
Share on other sites

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....

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...