var rect : Rect
Description描述
Where on the screen is the camera rendered in normalized coordinates.
相继被渲染到屏幕规范化坐标中的位置。
The values in rect range from zero (left/bottom) to one (right/top).
Rect的范围总0(左/下)到1(右/上)。
// Change the width of the viewport each time space key is pressed
//每次按下空格键时改变视口宽度
function Update () {
if (Input.GetButtonDown ("Jump")) {
// choose the margin randomly
//随机选择边缘
var margin = Random.Range (0.0, 0.3);
// setup the rectangle
//设置矩形
camera.rect = Rect (margin, 0, 1 - margin * 2, 1);
}
}