Game Development Reference
In-Depth Information
Engage thrusters
We will now create the MouseLook script to control our character by performing the fol-
lowing steps:
1. We will create the MouseLook script that will control our entire menu; go to As-
sets | Create | Javascript (for Unity JavaScript users) or Assets | Create | C# (for
C# users), name it MouseLook , double-click on it to launch MonoDevelop , and
we will start writing some code.
2. Open the MouseLook script file and type in the following variables:
// Unity JavaScript user:
#pragma strict
enum RotationAxes { MouseXAndY = 0, MouseX = 1, MouseY
= 2 }
var axes : RotationAxes = RotationAxes.MouseXAndY;
var sensitivityX : float = 5f;
var sensitivityY : float = 5f;
var minimumX : float = -10f;
var maximumX : float = 70f;
var minimumY : float = -5f;
var maximumY : float = 5f;
private var _characterControl : CharacterControl;
private var _rotationX : float = 0f;
private var _rotationY : float = 0f;
// C# user:
using UnityEngine;
using System.Collections;
public class MouseLook : MonoBehaviour {
Search WWH ::




Custom Search