Game Development Community

wheelchair's wheels code

by Noah Gomes · in Technical Issues · 12/25/2012 (9:15 pm) · 5 replies

I have a wheelchair model done, but I need help because there are two set sizes of wheels, I need help coding it

#1
12/26/2012 (2:47 am)
try something like this

datablock WheeledVehicleTire(FLWheelchairTire)
{
   shapeFile =  "art/shapes/vehicles/parts/Wheelchair/Wheelchair_front_tire.dts";
   mass = 20;

   rollingResist = 0.2;

   staticFriction = 4;
   kineticFriction = 6.5;

   // Spring that generates lateral tire forces
   lateralForce = 18000;
   lateralDamping = 3200;
   lateralRelaxation = 1;

   // Spring that generates longitudinal tire forces
   longitudinalForce = 18000;
   longitudinalDamping = 4000;
   longitudinalRelaxation = 0.01;
};

//----------------------------------------------------------------------------
datablock WheeledVehicleTire(FRWheelchairTire)
{
   shapeFile =  "art/shapes/vehicles/parts/Wheelchair/Wheelchair_front_tire.dts";

   mass = 20;

   rollingResist = 0.2;

   staticFriction = 4;
   kineticFriction = 6.5;

   // Spring that generates lateral tire forces
   lateralForce = 18000;
   lateralDamping = 3200;
   lateralRelaxation = 1;

   // Spring that generates longitudinal tire forces
   longitudinalForce = 18000;
   longitudinalDamping = 4000;
   longitudinalRelaxation = 0.01;
};

//----------------------------------------------------------------------------
datablock WheeledVehicleTire(RLWheelchairTire)
{
   shapeFile =  "art/shapes/vehicles/parts/Wheelchair/Wheelchair_rear_tire.dts";

   mass = 20;

   rollingResist = 0.2;

   staticFriction = 4;
   kineticFriction = 6.5;

   // Spring that generates lateral tire forces
   lateralForce = 18000;
   lateralDamping = 3200;
   lateralRelaxation = 1;

   // Spring that generates longitudinal tire forces
   longitudinalForce = 18000;
   longitudinalDamping = 4000;
   longitudinalRelaxation = 0.01;
};

//----------------------------------------------------------------------------
datablock WheeledVehicleTire(RRWheelchairTire)
{
   shapeFile =  "art/shapes/vehicles/parts/Wheelchair/Wheelchair_rear_tire.dts";

   mass = 20;

   rollingResist = 0.2;

   staticFriction = 4;
   kineticFriction = 6.5;

   // Spring that generates lateral tire forces
   lateralForce = 18000;
   lateralDamping = 3200;
   lateralRelaxation = 1;

   // Spring that generates longitudinal tire forces
   longitudinalForce = 18000;
   longitudinalDamping = 4000;
   longitudinalRelaxation = 0.01;
};

//----------------------------------------------------------------------------
datablock WheeledVehicleSpring(WheelchairSpring)
{
      //Wheel suspension properties
   length = 0.15;             // Suspension travel
   force = 3500;              // Spring force
   damping = 1500;            // Spring damping
   antiSwayForce = 3;         // Lateral anti-sway force
};

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

   %obj.setWheelTire(0,Rigid_FLTopfuelerTire);
   %obj.setWheelTire(1,Rigid_FRTopfuelerTire);
   %obj.setWheelTire(2,Rigid_RLTopfuelerTire);
   %obj.setWheelTire(3,Rigid_RRTopfuelerTire);

   // Steer front tires
   %obj.setWheelSteering(0,true);
   %obj.setWheelSteering(1,true);

   // Only power the two rear wheels... assuming there are only 4 wheels.
   %obj.setWheelPowered(2,true);
   %obj.setWheelPowered(3,true);
}

use your own names and file paths
#2
12/26/2012 (1:35 pm)
thanks man for the code. Do I need to change any other file
#3
12/26/2012 (5:29 pm)
@Noah,
I have an idea that I want to run past you concerning wheel chairs. Here is my email: ***********************
#4
12/26/2012 (7:40 pm)
The way I see this happening is to make a new class for wheelchairs.
The front wheels are similar to a car but they rotate 360 degrees in two directions. The rear wheels work similar to a car but also similar to tank tracks. A wheelchair will also be slightly different in how it handles uneven ground and bumps such as a curb or a pothole. Acceleration and braking is also different.
#5
12/27/2012 (4:03 pm)
Can I e-mail you the wheelchair. E-mail me at noah.gomes2@gmail.com