Using Modifier Keys
cInput supports the use of modifier keys. You can designate a key to be used as a modifier with AddModifier()
. Note that once a key has been designated as a modifier, it is forbidden from being used as an input all by itself. For example, if you designate LeftShift
as a modifier, then it can be used in multiple key combinations such as LeftShift+T
and LeftShift+1
, but it cannot be used alone as just LeftShift
. To define an action to use a modifier key by default, create it in your setup script with SetKey()
, passing in the modifiers you want to use.
Modifier keys do not work with axes! If you use SetKey()
to define an action that uses a modifier, and then use that action with SetAxis()
to create an axis, the axis won't care if the modifier is pressed or not.
For example, say you have defined an action named "Assign Group 1"
which uses LeftControl+Alpha1
(Ctrl+1) as the keys to activate it. If you then create an axis which uses "Assign Group 1"
as one of its inputs, then simply pressing 1
on your keyboard will activate the axis whether or not the LeftControl
key is being pressed.
If you have added a key as a modifier and would like to remove it from being used as a modifier, use RemoveModifier()
.
Last updated