Game Development Community

Vehicle wheels

by Quentin Headen · in Torque Game Engine · 06/03/2006 (11:49 am) · 4 replies

I just want to know how you mount wheels on a vehicle in the game. Like the buggy in the torque demo has the wheels mounted on, thats what I want to do with my car. In the car.cs script file for the buggy, I see the WheeledVehicleTire data, but I dont see anywhere in that script things like mounting points for the wheels. I need this help because I have the 3D car already modeled, and I also have the tire modeled, but I can't seem to get the tire mounted on the car. Please help me with this. Thank you.

About the author

Just your average programmer who tries to finish the projects he starts. :) I am currently focused on creating games with Torque engines. My website is http://phaseshiftsoftware.com


#1
06/03/2006 (12:12 pm)
Look for this datablock in you car script "WheeledVehicleTire"

"example" datablock WheeledVehicleTire(tankTire)

And the onAdd part as well this is for a wheeled tank of mine

function tank::onAdd(%this,%obj)
{
// Setup the car with some defaults tires & springs
for (%i = %obj.getWheelCount() - 1; %i >= 0; %i--) {
%obj.setWheelTire(%i,tankTire);
%obj.setWheelSpring(%i,tankSpring);
%obj.setWheelPowered(%i,false);
}
#2
06/03/2006 (12:41 pm)
I'm sorry, but can you break it down to me?
#3
06/03/2006 (1:48 pm)
I am a 3dmodeler not much of a scripter but the fist part loads the shape file "3dmesh"
"like this"
datablock WheeledVehicleTire(DefaultCarTire)
{
// Tires act as springs and generate lateral and longitudinal
// forces to move the vehicle. These distortion/spring forces
// are what convert wheel angular velocity into forces that
// act on the rigid body.
shapeFile = "~/data/shapes/buggy/wheel.dts"; <-your 3dmodel name gos here just edit the text and path
staticFriction = 5;
kineticFriction = 1.2;

Your tire is mounted with the "onAdd" function its just a matter of renameing the text to what your tire models name is and place it in the right path/folder onAdd for buggy is this.hope it helps

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);
}
#4
06/03/2006 (2:05 pm)
Thanks so much for your help. Thats the type of help I need because I know NOTHING about programming.