Hello, I am trying to modify the Standard Asset First Person Controller so that the character turns left and right when the left and right cursor arrow keys are pressed rather than strafing left and right. Can anyone help?
try looking for the function transform.Rotate
I would help you with a full code, but I don’t have unity in this computer.
but just look for the part on the code that control movement in one axis, comment it out, and write a quick one base on transform.Rotate
Thanks Animaleante, This is a big help. I have it working, not perfect, but working.
Glad to be of help. But why is it not perfect yet?
Well, I am designing a physical interface with three USB foot pedals, so I am still working out how I want the input to behave. Thanks
Could you post a snippet of the code that worked? I am struggling with this myself, and could use some help.
you could always set the inputs using the edit input menu which allows you to define the keys
Hello Amazingint, Could you please explain the specific input menu setting? I am trying to make the left and right cursor arrow turn a basic FPC rather than strafing.
Maybe I’m not understanding correctly (I am still quite new to Unity 3D), but isn’t the purpose of the edit input menu to let you define which key maps to “horizontal”? It doesn’t allow you to redefine what the “horizontal” input actually does (that is, turn or strafe), does it?
Hi, the input manager is used to map keys to different functions, even mouse axis…
edit > project settings > input
Then in the inspector window open up Mouse X
Change Type from Mouse Movement to Key or Mouse Button
Enter the key you wish to use for Left rotate (Z), for example; in the Negative Button.
Enter key for rotating right (x in my case) into the Positive Button field.
The Mouselook script uses Mouse X for left/right rotation, by editing what input to use for mouse x by this method means you don’t need to alter the original script at all… You’ll need to increase sensitivity in the rollout as keys give a smaller rotation rate than the mouse itself…
Using this method also means that if you leave the key remap menu available on the stand alone build the user can assign his/her own choice of rotate key without breaking your customised mouselook script as they’ll be redefining the keys you’ve set, but the axis they’re assigned to remains the same.
Oh and if you want to use the arrows they’re entered as “left” and “right” respectively (without the quotes)
Hey Amazingint, This rocks and it is such a clean solution. I can’t thank you enough. I had to change two more settings to make it work clean. I disabled strafing by deleting the entry to the Horizontal’s Negative and Positive Buttons and I set Mouse X’s gravity to .1 so that it does not spin endlessly. I am using Savant Elite Programmable USB Foot Switches http://www.kinesis-ergo.com/fs-savant-elite.htm. Here is what the installation looks like in a Soho gallery. Thanks again! Best
