I was wondering if there was any work-around way to trick javascript in unity into thinking you pressed a key (or acting as if you did)? If there is I would love to see an example.
Also when using input.GetAxis is there anyway to adjust the rate at which applies “smoothing filtering” (or the value of the range) without re-writing the entire code for it?
I’m a bit new and teaching myself all this so any help would be greatly appreciated.
I don’t know for sure that there isn’t (I doubt it), but the way I would personally approach this would be to have all your game logic query a group of functions (an “interface”) that you write yourself, when checking for input data. That way, you have the flexibility to either pass such stimuli on to the game logic, or - if you choose - suppress it so the game logic isn’t aware that the input event has occurred.
This method also allows you to reuse code with AI (artificial intelligence) subsystems, so, for example, you could have computer-controlled ‘bots’ playing alongside real human players, but all interfacing with the same input functions. It also means you can much more cleanly handle differences in input hardware across the different platforms supported by Unity - keyboards on PCs, touch input on phones/tablets, etc.