Game Development Community

Wheel steering: auto-return to neutral

by Karl Traunmueller · in Torque Game Engine · 10/04/2002 (7:45 am) · 8 replies

I couldn't find information on this problem, so here we go:

I'd like to know if there is a vehicle parameter or any other means to auto-return the wheels to neutral after steering. In the racing mod, the wheels keep their steering angle, and you have to manually steer them to neutral, which is rather annoying (and unnatural, because in a normal car, the steering returns to neutral when you release the steering wheel).

#1
10/04/2002 (8:26 am)
read this
#2
10/04/2002 (8:26 am)
Yes, I've posted some "auto-reset-hack" in an older thread - check it out... :)
#3
10/04/2002 (8:34 am)
Thx a bunch :)

btw, I've included a damping factor, so that the steering only gradually goes back to neutral:

if (move->yaw)
{
...
}
else
{
mSteering.x *= 0.7;
mSteering.y *= 0.7;
}

This gives satisfactory results.

Thank you for your help
#4
10/04/2002 (8:55 am)
where exactly do we place this?
#5
03/13/2003 (4:46 pm)
Hm, seems to be a small problem with this code. I didnt notice it as much while driving the rough racing demo map, but on flat, or relatively flat land, once the wheels are auto-centered, it seems that the lateral forces from the turn are still applied (it makes the car look likes its going to spin out, but drives in a circle with the wheels straight). Ive hacked through most of the code in vehicle.cc and cant seem to figure this one out. Anyone got any ideas?
Ryan
#6
06/14/2003 (4:28 pm)
I had exactly the same problem, I just removed the 'damping factor' from above, the difference isn't that great in term of handling or visuals except of course you can drive in a staright line without it!

Nice...
#7
03/04/2004 (10:50 pm)
I don't know if anyone else was as daunted by this task as I was when I looked through the above threads, but if someone was, I came up with my own simple script hack that can provide an auto-neutral function on your wheels.

(NOTE: This is using realease 1.2)

In ../client/scripts/default.bind.cs simply replace your turnLeft and turnRight functions with these:

function turnLeft( %val )
{
	if(%val)
		$mvYaw = -1;
	else
		$mvYaw = 0.5;
}

function turnRight( %val )
{
	if(%val)
		$mvYaw = 1;
	else
		$mvYaw = -0.5;
}

and of course make sure you have them bound to something:

moveMap.bind( keyboard, left, turnleft );
moveMap.bind( keyboard, right, turnright );

This will provide you with a classic digital style control on your keyboard commands but retains the analog precision on the mouse controls.

Hope someone finds that useful.

Peace,
-Rob
#8
03/04/2004 (10:59 pm)
Robert,

Does your code fixes the application of the lateral force for the turn after centering the wheels?

Alex