Game Development Reference
In-Depth Information
Input in Unreal
The Unreal Engine uses a fairly customizable event-driven system for
player input. The key bindings are all defined in an INI file, and each
key binding can be directly mapped to one or more functions written in
theUnrealscriptinglanguage.Forexample,iftherewerea Fire script
function that causes the player to fire his weapon, it could be mapped
to both the left mouse button and the right trigger on a controller with
the following bindings:
Click here to view code image
Bindings=(Name="LeftMouseButton",Command="Fire")
Binding-
s=(Name="XboxTypeS_RightTrigger",Command="Fire")
By default, these bindings get triggered when the key is “just pressed.”
It's also possible to have different actions occur when the key is
“just released” if the onrelease modifier is used. For example, the
following binding would cause the StartFire script function to
be called when the left mouse button is first pressed, and then the
StopFire function when it's released:
Click here to view code image
Binding-
s=(Name="LeftMouseButton",Command="StartFire |
onrelease
StopFire")
The pipe operator can be used to actually map any number of script
functions to one key press, so there is a great deal of flexibility. One
thingthatthiseventsystemisnotreallydesignedtohandle,however,is
menu input. For UI screens, Unreal instead provides an UpdateIn-
put function that can be overloaded to create the desired behavior.
Further information on the Unreal binding system can be found on
Epic's site at http://udn.epicgames.com/Three/KeyBinds.html .
One issue is that the current system has a tight coupling between specific buttons
and events. That is to say interested parties must register to a specific key press
Search WWH ::




Custom Search