Game Development Community

Mounting those other vehicle types - LOGGED

by Brian Mayberry · in Torque 3D Professional · 04/08/2010 (2:11 pm) · 2 replies

Sometime during the change from beta5 to beta1.1 the ability to mount any vehicle type was lost. I found this as a work around, but maybe there's a better way?

in player.cs, search for this:

// Mount vehicles
 if (%col.getType() & $TypeMasks::GameBaseObjectType)
   {
    %db = %col.getDataBlock();
      if ((%db.getClassName() $= "WheeledVehicleData" ) && %obj.mountVehicle && %obj.getState() $= "Move" && %col.mountable)
      {
         // Only mount drivers for now.
         %node = 0;
         %col.mountObject(%obj, %node);
         %obj.mVehicle = %col;
      }

Simply copy/paste this twice, changing WheeledVehicleData for FlyingVehicleData and HoverVehicleData.


Are there plans to expand the way vehicles work for 1.1 final or 1.2? I've noticed a few other oddities in this category that weren't in B5, but are in 1.1b. (Don't know about 1.0, I mostly skipped it) Such as mounted lights not appearing if player spawns as a vehicle, and camera nodes not being honored on non wheeled vehicles that a player mounts.

#1
08/21/2010 (9:09 am)
Logged as TQA-879.
#2
08/21/2010 (9:23 am)
Comparing individual vehicle classnames is unnecessary. This is how I allow/disallow vehicle mounting for all types:
if (%obj.mountVehicle && %obj.getState() $= "Move" && %col.mountable)
Logic being that if the player can mount a vehicle and the vehicle is mountable then there is no need for the classname check. The mountVehicle bool is pre-set in Armor::onAdd(), and the mountable bool for vehicles is pre-set in Vehicle::onAdd(). These can be overridden on a per object basis.