Game Development Community

Changing Keys?

by Lee-Orr Orbach · in Torque Game Engine · 08/06/2005 (12:37 am) · 4 replies

Hello there!
I have a problem with changing the default keys in default.bind.cs.
I have been trying to make the yaw and pitch, which use the mouse, use the arrow keys(wsad keys are already in use)

I tried doing this, but it didn't work.

function yawright(%val)
{
   $mvYaw += %val * 10;
}
moveMap.bind( keyboard, right, yawright)
function yawleft(%val)
{
   $mvYaw -= %val * 10;
}
moveMap.bind( keyboard, left, yawleft)
function pitchup(%val)
{
   $mvPitch += %val * 10;
}
moveMap.bind( keyboard, up, pitchup)
function pitchdown(%val)
{
   $mvPitch -= %val * 10;
}
moveMap.bind( keyboard, down, pitchdown)

and I commented the other functions that use the arrow keys

thanks in advance,
lee-orr

#1
08/06/2005 (3:54 am)
Lee-or

Those functions work but you are missing the semicolons off the end of your moveMap lines - if you have a look in your console log it should be showing an error.

You may also want to try smaller values to make for smoother turns - possibly %val * 0.1


function yawright(%val)
{
   $mvYaw += %val * 10;
}

moveMap.bind( keyboard, right, yawright); //<----

function yawleft(%val)
{
   $mvYaw -= %val * 10;
}

moveMap.bind( keyboard, left, yawleft); //<----

function pitchup(%val)
{
   $mvPitch += %val * 10;
}

moveMap.bind( keyboard, up, pitchup); //<----

function pitchdown(%val)
{
   $mvPitch -= %val * 10;
}

moveMap.bind( keyboard, down, pitchdown); //<----
#2
08/06/2005 (5:21 am)
I saw I was missing the semicolons right after posting, and it didn't change a thing.
I also deleted the .dso file, so that I will be sure it turned the script into a .dso, and didn't use the existing one.

thanks,
lee-orr
#3
08/06/2005 (6:58 am)
There are a couple of different files that get loaded up and define key bindings, if you are changing the one that is loaded first, another my be loaded after that and clobber your changes. This thread talks about it:

www.garagegames.com/mg/forums/result.thread.php?qt=30990

That may or may not help, but it can't hurt! :)

B--
#4
08/06/2005 (7:25 am)
YES!!! thanks!!!
brandon, thanks for the link, that did the trick
_____
|O O|
|_ U_ |

thanks for the help,
lee-orr