Game Development Reference
In-Depth Information
public enum RotationAxes { MouseXAndY = 0, MouseX =
1, MouseY = 2 }
public RotationAxes axes = RotationAxes.MouseXAndY;
public float sensitivityX = 5f;
public float sensitivityY = 5f;
public float minimumX = -10f;
public float maximumX = 70f;
public float minimumY = -5f;
public float maximumY = 5f;
CharacterControl _characterControl;
float _rotationX = 0f;
float _rotationY = 0f;
}
Now, we have all the necessary parameters for our script. The enum type is to
choose whether we need our script to control the X and Y rotations, only X , or
only the Y rotation.
3. Next, we will start creating the first function, Awake() , using the following code
to get the _characterControl component:
// Unity JavaScript user:
function Awake () {
_characterControl =
GetComponent.<CharacterControl>();
}
//C# user:
void Awake () {
_characterControl =
GetComponent<CharacterControl>();
}
Search WWH ::




Custom Search