Game Development Community

How can I Flip over a Vehicle that flipped over in my game?

by Dextr · in Torque Game Engine · 05/02/2007 (8:47 pm) · 2 replies

I made a bike that I turned in to a trike because the balance was terrible with only 2 wheels, but anyways every once in a while the bike flips over, and I was wondering if I could make a key activated function that flips it back. My engine code doses not compile for me "striate out of the box", so I rather not try and change it so I need a script solution.

About the author

Recent Threads


#1
05/02/2007 (8:58 pm)
// Used to flip the car over if it manages to get stuck upside down
function serverCmdflipCar(%client)
{
   %car = %client.getControlObject();

   if (%car.getClassName() $= "WheeledVehicle")
   {
      %carPos = %car.getPosition();
      %carPos = VectorAdd(%carPos, "0 0 3");

      %car.setTransform(%carPos SPC "0 0 1 0");
   }
}

// The key command for flipping the car
moveMap.bindCmd(keyboard, "ctrl f", "commandToServer(\'flipCar\');", "");
#2
05/02/2007 (8:59 pm)
You should probably also do a %car.setVelocity("0 0 0"); so people don't use it to cheat.

Gary (-;