Game Development Community

Wheeled vehicle wheel datablocks

by Rich Wilson · in Torque Game Engine · 02/13/2003 (10:44 am) · 1 replies

I was wondering if there was a way to specify which front and rear tire datablocks to use for a given wheeledvehicle datablock. As is, from what I can see, you define the front and rear wheel datablocks for all wheeled vehicles at one time, with:
datablock WheeledVehicleTire(TireFront) {...}

I can't see any way to specify which of these blocks to use for a specific wheeled vehicle. Anyone know what I'm missing here?

#1
02/13/2003 (11:47 am)
Look in car.cs for the following function:

function WheeledVehicleData::onAdd(%this,%obj)
{
   // Setup the car with some defaults tires & springs
   for (%i = %obj.getWheelCount() - 1; %i >= 0; %i--) {
      %obj.setWheelTire(%i,DefaultCarTire);
      %obj.setWheelSpring(%i,DefaultCarSpring);
   }
}

Copy and paste that function compleatly and change WheeledVehicleData to DefaultCar (or whatever the name of your wheeled vehicle datablock is)

function MyWheeledVehicle::onAdd(%this,%obj)
{
   // Setup the car with some defaults tires & springs
   for (%i = %obj.getWheelCount() - 1; %i >= 0; %i--) {
      %obj.setWheelTire(%i,MyNewCarTire);
      %obj.setWheelSpring(%i,MyNewCarSpring);
   }
}