Game Development Community

Yaw mapped to left and right arrow keys

by Jacob · in Torque Game Engine · 01/03/2005 (12:44 pm) · 7 replies

Hi all,

How would I go about mapping the player's yaw movement to the right and left arrow keys rather than the mouse axis? I don't need the sidestep movement so it's ok for me to replace that. I looked at where movements are mapped to keys but under the yaw it just gives the mouse axis which would control both left and right yaw. So, for the arrow keys, I would need a yawRight and a yawLeft - I think?

#1
01/03/2005 (12:48 pm)
Bind whatever keys you like, a and s, for example.

I belive the mouse takes the relative movement of the mouse and adds it to the global trigger, which is tied to the yaw.

So for key presses, every time you click a button just incriment or decriment the same global trigger.
#2
01/03/2005 (1:01 pm)
Anthony, perhaps you explained it correctly but being new, I didn't quite get it...when I look at "moveMap.bind(mouse0, "xaxis", yaw);" in client/config.cs, I see just one yaw, which I assume somehow knows that when you move the mouse to the left, it will yaw to the left and when you move right, it will yaw right. How can I put two keyboard keys in the place of "xaxis" - one for right and one for left? If I put in just one key - let's say "a" in the place of "xaxis", it only yaws to the right in the game and only if I repeatedly press "a"...what about yaw to the left? Do you see what I mean?
#3
01/04/2005 (6:52 am)
That is why I said incriment AND decriment, use one to add the delta to the trigger and the other to subtract the delta from the trigger
#4
01/04/2005 (8:18 am)
Gotcha - thanks! I will try to figure this out but being new to programming, I may have to ask how to go about adding and subtracting from the global trigger. That would be in code and not in script, right?
#5
01/11/2005 (9:14 am)
Well, I looked in code but at this point have not developed the skill to attempt figuring it all out. Can I do this in script somehow or does it have to be changed in code?
#6
01/11/2005 (5:47 pm)
I did this just today. Lemme see if I can do this from memory:

Find a file called default.bind.cs. I think it's in server/scripts.

Look in the file for the KeyMap.bind (or is it ActionMap.bind?) commands for "a" and "d". These key bindings should map to moveLeft and moveRight, respectively. Change the bindings to turnLeft and turnRight

turnLeft and turnRight are already defined for you. They are equivalent to the yawLeft and yawRight you were looking for.

The mouse still uses the "yaw" stuff, but you can either disable it or leave it there for user flexibility.
#7
01/11/2005 (8:19 pm)
That sure was easy! I am grateful!