3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1]

Author Topic: Steering script help  (Read 106 times)

« on: April 21, 2014, 06:10:13 PM »
I need help with this script I'm working on it manages the pcars steering angle through the script object so I can customize the cars steering but I can't figure out how to get this script to use both the left and right controls.
Code: [Select]
float Time = 0.04;
float NormalTurn = 1.0f/60f;
float TurnSpeed = Time;
float Turn = 1.0/60;
void Main()
{
if (iInitializing())
{
Turn = NormalTurn;
}
if (iKeyDown(iKeyCode("DIK_Left")))
{
Turn = iFloatTendTo(Turn,NormalTurn,1,TurnSpeed,0);
OUT_0 = iFloatTendTo(Turn,NormalTurn,1,TurnSpeed,0);
}
else
{
Turn = iFloatTendTo(Turn,1,NormalTurn,TurnSpeed,0);
OUT_0 = iFloatTendTo(Turn,1,NormalTurn,TurnSpeed,0);
}
if (iKeyDown(iKeyCode("DIK_Right")))
{
Turn = iFloatTendTo(Turn,NormalTurn,-1,TurnSpeed,0);
OUT_0 = iFloatTendTo(Turn,NormalTurn,-1,TurnSpeed,0);
}
else
{
Turn = iFloatTendTo(Turn,-1,NormalTurn,TurnSpeed,0);
OUT_0 = iFloatTendTo(Turn,-1,NormalTurn,TurnSpeed,0);
}
}
I be trippin!
Pages: [1]