Game Development Reference
In-Depth Information
Vector3(-_rotationY, _rotationX +
_characterControl.GetCharacterEulerAngle.y, 0);
} else if (axes == RotationAxes.MouseX) {
_rotationX = transform.localEulerAngles.y +
Input.GetAxis("Mouse X") * sensitivityX;
_rotationX = Mathf.Clamp (_rotationX, minimumX,
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);
}
}
// C# user:
void Update () {
if (axes == RotationAxes.MouseXAndY) {
_rotationX += Input.GetAxis("Mouse X") *
sensitivityX;
_rotationX = Mathf.Clamp (_rotationX, minimumX,
maximumX);
_rotationY += Input.GetAxis("Mouse Y") *
sensitivityY;
_rotationY = Mathf.Clamp (_rotationY, minimumY,
maximumY);
transform.localEulerAngles = new
Vector3(-_rotationY, _rotationX +
_characterControl.GetCharacterEulerAngle.y, 0);
} else if (axes == RotationAxes.MouseX) {
_rotationX = transform.localEulerAngles.y +
Input.GetAxis("Mouse X") * sensitivityX;
_rotationX = Mathf.Clamp (_rotationX, minimumX,
Search WWH ::




Custom Search