0
\$\begingroup\$

For a game I am making I would like the user to be able to change the controls (in game NOT through the clunky launch window (wich i disabled)) I have the system working but don't know how to change the controls for FPS controller. I am okay with writing my own version of the FPSInputController but I don't really know how to do that (the good way (using the CharcaterMotor)) I looked at the original FPSInputController script but that used axes (from the "conventianal" input settings in unity) and I don't really know how to do that with:

if (Input.GetKey(controls.forward))
\$\endgroup\$
  • \$\begingroup\$ So I was thinking "this is what the Input Manager is for, using Input.GetButton() and Input.GetAxis() but it turns out that it is not currently a feature to be able to modify those keys from within the game, only if the player shuts the game down and restarts it and the game uses the default configuring startup prompt. It is a highly requested feature that is still only "planned: long term, uncertain". \$\endgroup\$ – Draco18s Jan 28 '16 at 15:40
1
\$\begingroup\$

I would create a separate InputMapping class that simply correlates different Unity input names with my own input names. Then other parts of the game (eg. a keyboard settings popup) can change these mappings (eg. what InputMapping.Forward maps to). Now change the FPS movement script to use the settings from InputMapping instead of referring to Unity inputs directly.

\$\endgroup\$
  • \$\begingroup\$ Yeah, I was trying to do this but the unity FPS movement script uses a the horizontal and vertical input 'axes' to define a Vector3 directionVector variable and I for the life of me don't know how to do that with just Input.GetKey or something like that \$\endgroup\$ – koekeritis Mar 1 '15 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.