Game Development Community

Pitch/Yaw Problem

by Alfio Saitta · in Torque 3D Professional · 07/31/2010 (5:42 am) · 1 replies

I'm having trouble turning the camera with the mouse. As you can see in the video, during the rotations performed by holding down the right mouse button, the camera briefly follows the mouse movement, but back to the previous direction. The strange thing is with the classical movements (WSAD), the camera behaves well.


Part of my default.bind.cs
function yaw(%val)
{
   %yawAdj = getMouseAdjustAmount(%val);
   if(ServerConnection.isControlObjectRotDampedCamera())
   {
      // Clamp and scale
      %yawAdj = mClamp(%yawAdj, -m2Pi()+0.01, m2Pi()-0.01);
      %yawAdj *= 0.5;
   }

   $mvYaw += %yawAdj;
}

function pitch(%val)
{
   %pitchAdj = getMouseAdjustAmount(%val);
   if(ServerConnection.isControlObjectRotDampedCamera())
   {
      // Clamp and scale
      %pitchAdj = mClamp(%pitchAdj, -m2Pi()+0.01, m2Pi()-0.01);
      %pitchAdj *= 0.5;
   }

   $mvPitch += %pitchAdj;
}

#1
08/03/2010 (5:59 pm)
Have you done any modifications to the source code, like moveManager.cpp, for example?

The script code looks good.