Game Development Community

TGEA 1.7.0 BUG Player mControlObject

by Bill Vee · in Torque Game Engine Advanced · 05/23/2008 (7:23 pm) · 1 replies

In 1.0.3 when you mounted a vehicle , Player::mControlObject was set and transmitted to the server thru Player::writePacketData.
In 1.7.0 the setting of Player::mControlObject doesn't happen till after you toggle the camera with "alt + c".
And when you unmount the vehicle the bug gets reset so that the next time you enter a vehicle you have to toggle the camera with "alt + c" again to get it to set Player::mControlObject correctly.

As far as I can tell it appear to be the difference between calling Player::setControlObject as it does when you mount a vehicle and calling it with GameConnection::setControlObject when you toggle the camera.

Player::setControlObject doesn't set Player::mControlObject correctly and
GameConnection::setControlObject does.

It may be related to new code added to allow the camera to use the camera node of the vehicle as appose to the player when a player is mounted to a vehicle.

This is a video that demonstrates the bug.

I am not sure that the free look bug as just the player and as the player mounted to a vehicle are the same bug.

I think the fix in that thread is not the correct one as it would break free looking while in a vehicle.

#1
05/24/2008 (9:47 am)
Ok found the problem.
In the Players.cs file
function PLAYERDATA::onCollision(%this,%obj,%col)
{
   if (%obj.getState() $= "Dead")
      return;

   // Try and pickup all items
   if (%col.getClassName() $= "Item") {
      %obj.pickup(%col);
      return;
   }

   // Mount vehicles
   %className = %col.getDataBlock().getclassName();
   if((%className $= WheeledVehicleData || %className $= FlyingVehicleData || %className $= HoverVehicleData || %className $= JetBikeData)
      && %obj.mountVehicle && %obj.getState() $= "Move")
   {
      // Only mount drivers for now.
      if(%col.mountable && %col.getMountNodeObject(0) == 0)
      {
         // Only mount drivers for now.
         %node = 0;
         %col.mountObject(%obj,%node);
         %obj.mVehicle = %col;
         [b]%obj.client.setcontrolobject(%col);[/b]
      }
   }
}

If you change %obj.client.setcontrolobject(%col); to %obj.setcontrolobject(%col); free look can be used and control of the mounted object is set correctly.

Free look while as just the player still doesn't work right however.