Game Development Community

TGEA 1.8.1 Vehicles

by CdnGater · in Torque Game Engine Advanced · 08/04/2009 (10:33 am) · 6 replies


I took a stock TGEA 1.8.1 install, started the T3D application, added the DefaultCar to the mission, hopped into the car, then wow.

1) When moving the top layer of terrain is jerky.
2) The buggies wheels vibrate when moving, especialy when turning. (Like they are auto centering)
3) When trying to turn a corner, you practically have to throw your mouse across the room to get the car to turn, and when it does turn, the terrain jumps back and forth.

So I added a FlyingVehicle, same thing, yet a HoverVehicle seems to be fine.

Is this expected vehicle behaviour out of a stock TGEA 1.8.1 ? I know some of the ealier versions of the engines back to TGE at least, vehicles were smooth running and did not demostrate the issues I saw wuth 1.8.1.

Has anyone added vehicles and got them working as they should?

Thanks

#1
08/04/2009 (2:23 pm)
The problem is your avatars feet are dragging the ground. For some odd reason, the sitting animation isn't working. If you add the car as a player everything works as expected.
#2
08/05/2009 (11:03 pm)
In the players onMount function in player.cs i commented out the if statement but left the code in place and at the end of the function added:

commandToServer('ToggleCamera');

this fix is kinda a hack and does not solve the problem but it works none the less.
#3
08/06/2009 (3:31 pm)
Quote:The problem is your avatars feet are dragging the ground

the problem is that you car is The Flintstones car :D
#4
08/06/2009 (4:27 pm)
I think that was supposed to be funny ;)

There is an unnecessary (and erroneous) setControlObject() call when you mount vehicles which causes interference with the controls when the onMount() callback is hit. Inside of "scripts/server/player.cs" find function PLAYERDATA::oncollision() and remove/comment this line
%obj.client.setcontrolobject(%col);
Umm... sitting does work, but not all of the supplied players have a sitting animation.

Oh, and here is a simpler onCollision() method if you want to slim some code down.
function PLAYERDATA::onCollision(%this, %obj, %col)
{
   if (%obj.getState() $= "Dead")
      return;

   // Try and pickup all items
   if (%col.getClassName() $= "Item")
   {
      %obj.pickup(%col);
      return;
   }

   // Mount vehicles
   if (%col.getType() & $TypeMasks::GameBaseObjectType)
   {
      if (%obj.mountVehicle && %obj.getState() $= "Move" && %col.mountable)
      {
         // Only mount drivers for now.
         %node = 0;
         %col.mountObject(%obj, %node);
         %obj.mVehicle = %col;
      }
   }
}
Maybe later I could show more improvements/advancements/fixes for these old scripts.
#5
08/06/2009 (10:01 pm)
Hey Micheal, you know i saw that line in onCollision and thought it was rather odd to see it there, but never gave it a second thought. Thanks for pointing it out. that does the trick.

Ignore my prev. post and go with Micheal Hall's fix. :P
#6
08/07/2009 (5:03 am)
Thank you Micheal, that did the trick.