Vehicle controls handling
by Dennis Lamers · in Torque Game Engine · 12/18/2012 (5:53 am) · 4 replies
I noticed that normal Torque Game Engine games have a normal vehicle handling with rotating the car with the mouse. Is there a way to change this? To drive only with W, D, S, A? And for flying vehicles using the mouse?
About the author
Creator of Peekarica and Blockland Classic Mod.
#2
it should work on tge.it is 3 years old code and that time i was a novice.
u better try to improve it more.
or wait for someone having tge source.
12/18/2012 (7:12 am)
here it is: mouse emulating through keyboard
$pitchIncValue=.03;
$pitchDecValue=.03;
$yawIncValue=.03;
$yawDecValue=.03;
function incresePitch()
{
echo("incresePitch()");
$mvPitch += $pitchIncValue;//.3;
echo($pitchIncValue);
$pIncSch=schedule(10, 0, "incresePitch");
}
function decreasPitch()
{
echo(" decreasPitch()");
$mvPitch -= $pitchDecValue;//.3;
echo($pitchDecValue);
$pDecSch=schedule(10, 0, "decreasPitch");
}
function increseYaw()
{echo("increseYaw()");
$mvYaw += $yawIncValue;
echo("$yawIncValue "@$yawIncValue);
cancel($yawIncSch);
$yawIncSch=schedule(10, 0, "increseYaw");
}
function decreasYaw()
{echo("decreasYaw()");
$mvYaw -= $yawDecValue;
echo("$yawDecValue "@$yawDecValue);
cancel($yawDecSch);
$yawDecSch=schedule(10, 0, "decreasYaw");
}
function kbpitchDown(%val)
{
if (%val)
incresePitch();
else
cancel($pIncSch);
}
function kbpitchUp(%val)
{
if (%val)
decreasPitch();
else
cancel($pDecSch);
}
function kbyawRight(%val)
{
if (%val)
increseYaw();
else
cancel($yawIncSch);
}
function kbyawLeft(%val)
{
if (%val)
decreasYaw();
else
cancel($yawDecSch);
}
moveMap.bind( keyboard, up, kbpitchDown );
moveMap.bind( keyboard, down, kbpitchUp );
vehicleMap.bind( keyboard, up, kbpitchDown );
vehicleMap.bind( keyboard, down, kbpitchUp );
vehicleMap.bind( keyboard, left, kbyawLeft );
vehicleMap.bind( keyboard, right, kbyawRight );
vehicleMap.bind( keyboard, right, kbyawLeft );
vehicleMap.bind( keyboard, left, kbyawRight );it should work on tge.it is 3 years old code and that time i was a novice.
u better try to improve it more.
or wait for someone having tge source.
#3
12/18/2012 (9:57 am)
Have a actionmap for wheeled vehicles that uses the keybinds, have another for flying vehicles that uses the mouse. Push and pop the relevant map when mounting or as needed, it's as simple as that.
Ahsan Muzaheed
Default Studio Name
but for t3d there is a resource to change vehicle control from mouse to keyboard.
u can try that.
do a search.
or u can emulate mouse control through keyboard.look into $yaw and $pitch on script side.
i was planning to release a resource to change vehicle control from mouse to keyboard without changing any source.but not enough time for that.
if i manage time than i will post it here.