Game Development Reference
In-Depth Information
maximumX);
transform.Rotate(0, _rotationX +
_characterControl.GetCharacterEulerAngle.y, 0);
} else {
_rotationY += Input.GetAxis("Mouse Y") *
sensitivityY;
_rotationY = Mathf.Clamp (_rotationY, minimumY,
maximumY);
transform.localEulerAngles = new
Vector3(-_rotationY, transform.localEulerAngles.y, 0);
}
}
Note
transform.localEulerAngles : This is the parameter that we can use to
set up the rotation based on the degree of each axis that is related to the parent
transform.
For more details on this, visit the following Unity website:
http://docs.unity3d.com/Documentation/ScriptReference/Transform-localEuler-
Angles.html
6. Now, we need to go back to our CharacterControl script and add more vari-
ables using the following highlighted code:
// Unity JavaScript user:
enum MOTION_STATE {GROUND,JUMP,FALL,JUMP_HOLD,AIM}
private final var GUN_LASER_DISTANCE : float = 1000f;
var laser : LineRenderer;
private var _mouseLook : MouseLook;
// C# user:
public enum MOTION_STATE
Search WWH ::




Custom Search