Key Controls and Vehicles
by Gareth Hewes · in Torque Game Engine · 10/14/2008 (7:30 pm) · 5 replies
I couldn't find anything relating to this on the forums here...but I was just wondering...
I want to change the control on the vehicle (TGEA 1.7), and I was looking at the script for car.cs, but there is nothing I can see as far as the mapping of the vehicle control. Right now the control is shaky at best with the mouse, so I just wanted to remap the vehicle controls to left/right being A and D, respectively.
I don't mind if the change is a hack, as I'm not looking into changing any source, so if it's hardwired, what might be a good way to override the mouse and use the keyboard for control?
I want to change the control on the vehicle (TGEA 1.7), and I was looking at the script for car.cs, but there is nothing I can see as far as the mapping of the vehicle control. Right now the control is shaky at best with the mouse, so I just wanted to remap the vehicle controls to left/right being A and D, respectively.
I don't mind if the change is a hack, as I'm not looking into changing any source, so if it's hardwired, what might be a good way to override the mouse and use the keyboard for control?
#2
10/14/2008 (9:35 pm)
A quick update--the TAB issue was caused because I had a semicolon after the function definition. I don't know why that would make a difference, but it seems it does.
#3
07/03/2009 (3:24 am)
Would you like to post the code here. just as a reference. thanks in advance
#4
http://www.garagegames.com/community/resources/view/6305
I recommend using Matt Zuhlke's "Jitter Fix" as well as that is what I have used.
if your using a seperate vehicleMap then:(instead of moveLeft and moveRight)
vehicleMap.bind( keyboard, "a", turnLeft );
vehicleMap.bind( keyboard, "d", turnRight );
07/06/2009 (12:03 am)
Vehicle Steering Upgrade: (C++ mod but very easy to add, not 100% sure if its TGEA compatible, either way check it out)http://www.garagegames.com/community/resources/view/6305
I recommend using Matt Zuhlke's "Jitter Fix" as well as that is what I have used.
if your using a seperate vehicleMap then:(instead of moveLeft and moveRight)
vehicleMap.bind( keyboard, "a", turnLeft );
vehicleMap.bind( keyboard, "d", turnRight );
#5
When i drive past a street, which has around 20 buildings, the car movement is smooth but there is considerable amount of jerk in rendering the building. any insight into that as to why its happening ?
07/20/2009 (10:38 pm)
Thanks csmp. that resource works well.When i drive past a street, which has around 20 buildings, the car movement is smooth but there is considerable amount of jerk in rendering the building. any insight into that as to why its happening ?
Torque Owner Gareth Hewes
I went into default.bind.cs in the client scripts, and found the motherlode for control functions. I defined a new ActionMap, called vehicleMap, that overrode A and D to change the $mvYaw value, and then went into the player.cs file and pushed it onto the stack inside the player's onMount, and popped it off when the player dismounted.
The problem seems to be fixed, I just encountered a couple of issues.
The vehicle code seems to be flawed, even without my messing around. The wheels always recenter (I can only assume the following cycle), so using the changed keys causes a slight jump to the side that then recenters. The same applies to the mouse, so I know I haven't caused this problem.
What I did notice, though, that seems a bit odd, is that when I told the vehicleMap to override the mouse with a null function, I was no longer able to use TAB to switch to third person. That seemed strange to me, and when I commented out the function, it worked fine again.
Any thoughts? Let's see where this takes us.