Game Development Community

jittery camera issues when porting from T3D1.1B3

by Jeff Yaskus · in Torque 3D Professional · 01/11/2012 (11:06 pm) · 0 replies

I'm working on porting over some levels I did with T3D 1.1B3 ... the starting level spawns an airplane (using projectile) and then attaches camera to said object.

// chain of events
a) load the level
b) spawn airplane as projectile
c) change camera view to track airplane object (using below code)
d) when airplane crashes, move player near plane and reset camera

I used code examples found in the forums ... [placed in scripts/server/commands.cs]
function serverCmdAttachCamToObject(%client, %obj)
{
   // Set the control state to the camera
   %client.setControlObject(%client.camera);
   
   // Set the camera mode to orbit the object
   %rot = mDegToRad(20) @ " 0 " @ mDegToRad(135);
   %minDist = 0;
   %maxDist = 50;
   %currDist = 0;
   %client.camera.setOrbitObject(%obj, %rot, %minDist, %maxDist, %currDist ,false,"0 0 0", true);
      
}

function serverCmdResetCam(%client)
{
   %control = %client.player;
   %control.mode = observerFly;
   %client.setControlObject(%control);
}

everything is now working with the ported level ... however, the camera is super jittery as it follows the moving plane.

It was not this way in T3D1.1B3 ... using the same code.

Not sure if/what else might have changed since B3 that could be affecting this ... any ideas?

About the author

I've been programming and playing computer games since the 80s and recently completed a game design / programming degree. Now looking forward to putting it to use and pay those student loans! ;)