Game Development Community

4WD Vehicles

by Justin Morris · in Torque Game Engine · 01/19/2005 (1:23 am) · 3 replies

I was just wondering if this is possible... when i try to give power to my 2 front wheels (steering wheels) aswell as the rear the game locks up so bad i cant even ctrl+alt+del it, so naturally i dont get any output from console.log, i figure it should be possible to get 4WD even tho my searches have not produced much results, just mainly people asking about vehicles with more than 4 wheels.

has anyone found a workaround for this problem?

#1
01/19/2005 (1:54 am)
Usually you just tell the script which wheels to power.
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);
      %obj.setWheelPowered(%i,false);
   }
   
   // Steer front tires
   %obj.setWheelSteering(0,1); //Front left wheel
   %obj.setWheelSteering(1,1); //Front right wheel

   // Power all four wheels
   %obj.setWheelPowered(0,true); //Front left wheel
   %obj.setWheelPowered(1,true); //Front right wheel
   %obj.setWheelPowered(2,true); //Rear left wheel
   %obj.setWheelPowered(3,true); //Rear right wheel
}

Thats out of a script for a four wheel drive vehicle. Works fine!!
Are you sure you don't have prblem with your model. A bad collision shape can bring it to hault. Are you running ver 1.3 of torque or somthing earlier.

Matt
#2
01/19/2005 (1:57 am)
I have encountered this before.

If you are running in Windows, and if the problem disappears when you disable the engine sound, your solution is at the bottom of this thread:

www.garagegames.com/mg/forums/result.thread.php?qt=21938
#3
01/19/2005 (12:32 pm)
Thank you that fixed the problem Eugene :)