Unity3D Unity Camera Class 摄像机类
inherits from Behaviour
继承自 行为 类
A Camera is a device through which the player views the world
摄像机是一种设备, 通过它来看世界
A screen space point is defined in pixels. The bottom-left of the screen is (0,0); the right-top is (pixelWidth, pixelHeight). The z position is in world units from the camera 屏幕空间点用像素定义. 屏幕的左下方为 (0, 0); 右上方为 (pixelWidth, pixelHeight). Z轴的位置是以世界单位衡量到摄像机的距离
A viewport space point is normalized and relative to the camera. The bottom-left of the camera is (0,0); the top-right is (1,1). The z position is in world units from the camera
视口空间点是规范化的并相对于摄像机的. 摄像机的左下方为 (0, 0); 右上方为 (1, 1). Z轴的位置是以世界单位衡量到摄像机的距离
A world space point is defined in global coordinates (eg.Transform.position)
世界空间中是以全局坐标定义的 (例如 Transform.position)
See Also: camera component
参见: 摄像机组件
Variables 变量
fieldOfView
The field of view of the camera in degrees.
摄像机的视野, 以度为单位
nearClipPlane
The near clipping plane distance
近裁剪平面的距离
farClipPlane
The far clipping plane distance
远裁剪平面的距离
orthographicSize
Camera's half-size when in orthographic mode.
在正交模式下摄像机的一半尺寸
orthographic
Is the camera orthographic (true) or perspective (false)?
摄像机是正交的 (真) 或透视的 (假)?
depth
Camera's depth in the camera rendering order
摄像机在渲染顺序上的深度
aspect
The aspect ratio (width divided by height)
长宽比 (宽度除以高度)
cullingMask
This is used to render parts of the scene selectively
用来选择性的渲染部分场景
backgroundColor
The color with which the screen will be cleared
屏幕将被清理为这个颜色
rect
Where on the screen is the camera rendered in normalized coordinates
摄像机被渲染到屏幕归一化坐标中的位置
pixelRect
Where on the screen is the camera rendered in pixel coordinates
摄像机被渲染到屏幕像素坐标中的位置
targetTexture
Destination render texture (Unity Pro only).
目标渲染纹理 (该方法只有 Unity 专业版提供)
pixelWidth
How wide is the camera in pixels (Read Only)
摄像机的像素宽度 (只读)
pixelHeight
How tall is the camera in pixels (Read Only)
摄像机的像素高度 (只读)
cameraToWorldMatrix
Matrix that transforms from camera space to world space (Read Only)
从摄像机空间到世界空间变换矩阵 (只读)
worldToCameraMatrix
Matrix that transforms from world to camera space
从世界到摄像机空间的变换矩阵
projectionMatrix
Set a custom projection matrix
设置一个自定义的投影矩阵
Velocity
Get the world-space speed of the camera (Read Only)
获取世界空间中摄像机的速度 (只读)
clearFlags
How the camera clears the background
摄像机如何清除背景
Functions 函数
ResetWorldToCameraMatrix
Make the rendering position reflect the camera's position in the scene
在场景中让渲染位置反映相机位置
ResetProjectionMatrix
Make the projection reflect normal camera's parameters
让投影反映正常的相机参数
ResetAspect
Revert the aspect ratio to the screen's aspect ratio
返回长宽比为屏幕的长宽比
WorldToScreenPoint
Transforms position from world space into screen space.
从世界空间到屏幕空间变换位置
WorldToViewportPoint
Transforms position from world space into viewport space.
从世界空间到视口空间变换位置
ViewportToWorldPoint
Transforms position from viewport space into world space.
从视口空间到世界空间变换位置
ScreenToWorldPoint
Transforms position from screen space into world space
从屏幕空间到世界空间变换位置
ScreenToViewportPoint
Transforms position from screen space into viewport space
从屏幕空间到视口空间变换位置
ViewportToScreenPoint
Transforms position from viewport space into screen space.
从视口空间到屏幕空间变换位置
ViewportPointToRay
Returns a ray going from camera through a viewport point.
返回从相机出发穿过视点的一个射线
ScreenPointToRay
Returns a ray going from camera through a screen point
返回从相机出发穿过屏幕点的一个射线
Render
Render the camera manually
手动渲染相机
RenderWithShader
Render the camera with shader replacement
用着色替换渲染相机
SetReplacementShader
Make the camera render with shader replacement
使相机用着色替换来渲染
ResetReplacementShader
Remove shader replacement from camera
从相机上删除着色替换
RenderToCubemap
Render into a cubemap from this camera
从这台相机渲染到一个立方体贴图
CopyFrom
Makes this camera's settings match other camera
使这台相机的设置与其他相机相同
Messages Sent 信息传递
OnPreCull
OnPreCull is called before a camera culls the scene
OnPreCull在相机开始裁剪场景之前调用
OnPreRender
OnPreRender is called before a camera starts rendering the scene
OnPreRender在相机开始渲染场景之前调用
OnPostRender
OnPostRender is called after a camera has finished rendering the scene
OnPostRender在相机渲染场景之后调用
OnRenderImage
OnRenderImage is called after all rendering is complete to render image
OnRenderImage在所有渲染完成后被调用, 来渲染图片
OnRenderObject
OnRenderObject is used to render your own objects usingGraphics.DrawMeshNow or other functions
OnRenderObject被用来渲染你自己的对象, 使用Graphics.DrawMeshNow或者其他函数
OnWillRenderObject
OnWillRenderObject is called once for each camera if the object is visible
如果对象可见, 每个相机都会调用OnWillRenderObject
Class Variables 类变量
main The first enabled camera tagged "MainCamera" (Read Only)
第一个启用的被标记为 "MainCamera" 的相机 (只读)
current
The camera we are currently rendering with, for low-level render control only (Read Only) 当前用于渲染的相机, 只用于低级的渲染控制 (只读)
allCameras
Returns all enabled cameras in the scene
返回场景中所有启用的相机
Inherited members 继承自成员
Inherited Variables 继承自变量
Object . Component . Behaviour
对象 . 组件 . 行为
Inherited Functions 继承自函数
Inherited Class Functions 继承自类函数
Object 对象