Open up the
Look at how
FPSInputController reads keypresses and then sends a command to the
CharacterMotor. You will want to create two new commands to pass (or possibly more, I've added "crouch" and "sprint" to mine, you're looking for "rotate right" and "rotate left"). You'll have to define new inputs as well, Edit -> Project -> Input. Add 2 to the array size and define your keys.
Start with the
FPSInputController as it will be simpler. Do not worry about if the lines you add throw errors that prevent compilation: you're simply trying to use a method you haven't made yet.
Next, go into the
CharacterMotor and implement the methods you are attempting to call in the
FPSInputcontroller. They might be named
setRotateLeft(), so find an existing one, e.g.
setJumping(), duplicate, rename, and alter the variable, then go define the variable (there are multiple classes inside this file, your input booleans should be part of the
CharacterMotor class, not the internal subclasses).
Next, find the
Update() function, it will call another function, go to its definition. Now add some lines that look at your rotateRight / rotateLeft booleans and do:
var dir:int = 0;
if(rotateRight && rotateLeft) dir = 0;
else if(rotateRight) dir = 1;
elseif(rotateLeft) dir = -1;
gameObject.transform.RotateAround(Vector3.zero, Vector3.up, dir * 20 * Time.deltaTime);
Alter the "20" amount until you have the desired rotation speed.