View Full Version : PlayerInput...or is it?
11-11-2009, 09:33 PM
Ok im using catchy titles to get you all to look at this. :D
Appreciate all the help so far.
The UTInput.ini file shows that the entire binding keyset is being created by Engine.PlayerInput. Funny thing is when I go to PlayerInput I do not see any bindings in defaultproperties...
What is going on? I know its being created by code somewhere but I can't seem to find it.
Help much appreciated.
11-11-2009, 09:44 PM
I don't really know. The unreal engine is a mystery. I tried looking into input, but gave up since it already does what I want.
But I would appreciate it if you told us if/when you figure it out.
Now that I said that, I just had to see if I could figure it out. (I didn't) If you look at a simple binding, such as
It seems to me that somewhere in some line of code there should be either a function called "MoveForward() or, a check for something == "MoveForward". Not that I have looked through all the code, but it wasn't in any of the files I would expect it to be in. Maybe I'm messing it up with some assumption?
I think I figured it out!
Like I have above, if you look at the line in BaseInput.ini:
You would expect there to be some command MoveForward. There is, it is just not in code. It is 20 lines above it in the same file:
Bindings=(Name="MoveForward",Command="Axis aBaseY Speed=1.0")
Now that command does appear in the code. Line 52 of PlayerInput.uc:
var input float aBaseX;
Sooo, it looks like to me that the .ini files setup a direct change to the variables in PlayerInput.uc, then when the game runs it just always applies the direct changes you wrote in BaseInput.ini (or whatever .ini file) and then straight changes the variables in code. Not quite the best way imo, and I still could be wrong.
11-11-2009, 10:11 PM
I'm portable right now, and haven't really been through the code, but you might want to check in PlayerController for MoveForward.
11-11-2009, 10:35 PM
Actually that gave me an idea on how to search all the code. Since http://wiki.beyondunreal.com/Category:UDK-specific_classes has the entire code set, the search should turn up any function or whatever using a text search. It didn't, though it did turn up the ini file and the bindings. I stand by my previous idea.
11-11-2009, 11:18 PM
DebugCameraInput is declared within PlayerController, and aliases MoveForward to "Axis aBaseY Speed=1.0".
Sometimes google can't find something that is on the internet! :D
So, yes, as I re-read the OP, it does look like that is correct. The MoveForward command does actually change the input variables.
And this is from the wiki re: input variables, on a legacy page..
<wiki>"Input" variables can be mapped to the console, by binding a key to a special console command. Only byte or float variables can be input variables. The appropriate console commands to bind an input variable to a keyboard/mouse/joystick input are:
Button <variable name>: The input variable is 1 if the button is pressed, 0 otherwise. Should be a byte variable.
Count <variable name>: This variable will increment every time the button is pressed. If it is an axis, this will increment every time a new input is recieved. This can be useful for checking to see if an input has changed since it was last checked. It will wrap around when it reaches 255. This should use a byte variable.
Axis <variable name> <arguments> The only one that takes arguments is also the only one meant for use with floats. This captures axis movement. Depending on the axis in question, this may be an absolute value (as with joysticks) or it may be a relative value. (as with mice) Arguments are specified in the format argument name=value and the valid arguments are:
Speed: Appears to be a simple multiplier for the input. Seems to be useful on mice.
SpeedBase: Appears to be an exponential multiplier for the input. Seems to be useful on joysticks.
Deadzone: Inputs within this amount of zero are not set into the axis variable and are registered as 0. This appears to be applied BEFORE speed or speedbase.
Invert: Interestingly, this appears to be a simple multiplier. Set to -1 to invert the axis.
Note that Interactions are better for most input capturing, as input variables require subclassing PlayerController. (or PlayerPawn in the case of UnrealEngine1) Axis input variables can also only be accessed within the PlayerTick function - outside of this function they will always be zero. (though the variable can be stored in another variable that will be accessible anytime.) The only real reason to use input variables in UnrealEngine2 is because Interactions do not capture joystick axis movement.
11-11-2009, 11:52 PM
Nice Blade. Yet again the Unreal engine does something in a weird way.
11-12-2009, 08:08 PM
Hrmmm. Ok so basically we don't create the bindings through defaultproperties and everything needs to be binded through a config file. I was really hoping you would say oh the bindings in the defaultproperties are right here, are you blind!
11-12-2009, 08:19 PM
but this direction opens you a lot of chances. just take as an example cs buy-keybinds(??)
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.