Steve_Yorkshire Posted February 4, 2015 Share Posted February 4, 2015 I have been digging around in the camera related C++ parts of the engine after noticing a few strange going ons with OrbitMode/OrbitObject. function serverCmdisoCam(%client, %deg) { //mDegToRad(35.264) = 0.615472907 //true isometric //mDegToRad(90) = 1.570796 //true top down echo("\c1isocam " @ %deg); %camera = %client.camera; %control = %client.player; if(%deg < 5) { echo("\c2error: deg < 5 setting to ServerConnection.getControlCameraDefaultFov " @ ServerConnection.getControlCameraDefaultFov()); %deg = ServerConnection.getControlCameraDefaultFov(); } %rad = mDegToRad(%deg); if(!isObject(%control)) echo("\c2error: no control object for client " @ %client); else %camera.setOrbitObject(%control, %rad @ " 0 0", 5.0, 20.0, 20.0, true, "0 -4 2", false); } When orbiting a control object (such as the player) and sending a new server command to change the rotation or distance or offset of the camera, all values update except for rotation which does not change. However when checking what the rotation is with Torquescript it returns the updated rotation even though the camera/screen rotation has clearly not changed.It turns out that in camera.cpp readPacketData does not read position for orbiting because it is inhereted from the object (makes sense) but that it also does not unpack the rotation, meaning that the orbit rotation around the object can only be called once when it is initially set to orbit the object. //line 1146 camera.cpp _setPosition(pos,rot); // Movement in OrbitObjectMode is not input-based - don't reset interpolation if(mMode != OrbitObjectMode) { mDelta.pos = pos; mDelta.posVec.set(0.0f, 0.0f, 0.0f); mDelta.rot = rot; mDelta.rotVec.set(0.0f, 0.0f, 0.0f); } I cannot see any particular reason for the rotation to be unread, so I propose the following change to add rotation for orbitModes. _setPosition(pos,rot); // Movement in OrbitObjectMode is not input-based - don't reset interpolation if(mMode != OrbitObjectMode) { mDelta.pos = pos; mDelta.posVec.set(0.0f, 0.0f, 0.0f); mDelta.rot = rot; mDelta.rotVec.set(0.0f, 0.0f, 0.0f); } else//york new { //yorks pass rotation for orbitmode mDelta.rot = rot; mDelta.rotVec.set(0.0f, 0.0f, 0.0f); }//yorks new end Now when %client.setOrbitMode/Object is called via a server command it will update the rotation as well as all the rest of the passed values such as distance and offset. Quote Link to comment Share on other sites More sharing options...
Steve_Yorkshire Posted February 5, 2015 Author Share Posted February 5, 2015 In practice video:raGkoyQPb1w Quote Link to comment Share on other sites More sharing options...
rlranft Posted February 9, 2015 Share Posted February 9, 2015 You know, it's funny that I never noticed this - probably because I was using the mouse to control the camera instead of directly setting the values. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.