Camera翻译:Yīm
- actualRenderingPath
- allCameras
- aspect
- backgroundColor
- cameraToWorldMatrix
- clearFlags
- CopyFrom
- cullingMask
- current
- depthTextureMode
- depth
- farClipPlane
- fieldOfView
- layerCullDistances
- main
- nearClipPlane
- OnPostRender
- OnPreCull
- OnPreRender
- OnRenderImage
- OnRenderObject
- OnWillRenderObject
- orthographicSize
- orthographic
- pixelHeight
- pixelRect
- pixelWidth
- projectionMatrix
- rect
- renderingPath
- RenderToCubemap
- RenderWithShader
- Render
- ResetAspect
- ResetProjectionMatrix
- ResetReplacementShader
- ResetWorldToCameraMatrix
- ScreenPointToRay
- ScreenToViewportPoint
- ScreenToWorldPoint
- SetReplacementShader
- targetTexture
- velocity
- ViewportPointToRay
- ViewportToScreenPoint
- ViewportToWorldPoint
- worldToCameraMatrix
- WorldToScreenPoint
- WorldToViewportPoint
Camera.cameraToWorldMatrix 相机转世界矩阵
var cameraToWorldMatrix : Matrix4x4
Description描述
Matrix that transforms from camera space to world space (Read Only).
从相机空间到世界空间的变换矩阵(只读)。
Use this to calculate where in the world a specific camera space point is.
使用这个来计算相机空间中的一个点在世界坐标中的什么位置上。
Note that camera space matches OpenGL convention: camera's forward is the negative Z axis. This is different from Unity's convention, where forward is the positive Z axis.
注意相机空间与OpenGL的约定时间;相机的前面为Z轴负方向。这不同于Unity的约定,向前为Z轴正向。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public float distance = -1.0F;
void OnDrawGizmosSelected() {
Matrix4x4 m = camera.cameraToWorldMatrix;
Vector3 p = m.MultiplyPoint(new Vector3(0, 0, distance));
Gizmos.color = Color.yellow;
Gizmos.DrawSphere(p, 0.2F);
}
}
// Draw a yellow sphere in scene view at distance
// units along camera's viewing direction.
//在屏幕视图绘制一个黄色的球,以Distance单位,沿着相机所看方向
var distance : float = -1.0;
function OnDrawGizmosSelected () {
var m : Matrix4x4 = camera.cameraToWorldMatrix;
var p : Vector3 = m.MultiplyPoint (Vector3(0,0,distance));
Gizmos.color = Color.yellow;
Gizmos.DrawSphere (p, 0.2);
}
最后修改:2011年3月6日 Sunday 21:01