Game Development Community

Crash when mounting wheeled vehicles

by Richard Jones · in Torque Game Engine · 03/06/2002 (5:00 pm) · 2 replies

Hi,

I have successfully implemented the mounting code supplied by BadGuy which seems to work fine with the flying Drone vehicle supplied. However, when I try and mount a wheeled vehicle I get a crash on line 237 of SimBase.h

SimObjectId getId() const { return mId; }

If I walk into the vehicle away from the mount point I sustain damage (which I assume is supposed to happen), but if I touch the vehicle near the mount point I get the previously mentioned crash.

I have tried several different vehicles, but they all cause the problem. Also, the vehicles work fine in every other way (ie. I can put them in the Racing Demo and they work OK).
Has anyone got any ideas as to what could be wrong?
I'm going to look into it more tomorrow, but I've got a terrible sore throat and its 1am here. (1,2,3, ahh)

Thanks :)

#1
03/16/2002 (7:44 am)
Yup, I seem to have the same problem. Anyone run across anything that might be causing it?
#2
03/16/2002 (4:20 pm)
Hi Chris,

I figured out what the problem was so if you are getting exactly the same problem, this should fix it.

Basically, you need to set...

%obj.mountable = true;

...when you create your wheeled vehicle.

Basically, in my car.cs file I now have the following function (which I copied frome the Flying vehicle code and modified)

function WheeledVehicleData::create(%data, %team, %oldObj)
{
if(%oldObj $= "")
{
%obj = new WheeledVehicle()
{
dataBlock = %data;
respawn = "0";
teamBought = %team;
team = %team;
};
}
else
{
%obj = new WheeledVehicle()
{
dataBlock = %data;
respawn = "0";
teamBought = %team;
team = %team;
mountable = %oldObj.mountable;
disableMove = %oldObj.disableMove;
resetPos = %oldObj.resetPos;
deployed = %oldObj.deployed;
respawnTime = %oldObj.respawnTime;
marker = %oldObj;
};
}
%obj.mountable = true;

return(%obj);
}