Proper way to mount/unmount a car?
by Neil Marshall · in Torque Game Engine · 08/24/2002 (2:19 pm) · 1 replies
What is the proper way to mount/unmount a car?
The code I'm using now sometimes causes part or all of the car to fall through the ground, and on a couple occasions, it has crushed the player to death. :)
The code I'm using now sometimes causes part or all of the car to fall through the ground, and on a couple occasions, it has crushed the player to death. :)
function serverCmdAddBuggy(%client)
{
if (%client.player $= "" )
return;
if (%client.player) {
if (%client.player.isMounted())
return;
}
%buggy = new WheeledVehicle()
{
datablock = DefaultCar;
};
%buggy.mountable = true;
%buggy.setEnergyLevel(60);
%buggy.setTransform( %client.player.getEyeTransform() );
MissionCleanup.add(%buggy);
}
Associate Stefan Beffy Moises
like this:
%pos = %player.getTransform(); %x = getWord(%pos, 0); %y = getWord(%pos, 1); %z = getWord(%pos, 2); %x += 2.0; %y += 2.0; %z += 1.0; %myVehicle.setTransform(%x SPC %y SPC %z);Or write a more advanced function taking the playerTransform and checking for collision with every possible object type and also checking the terrain height and then placing it at the a good and free position...