camera.cameratoworldmatrix 相机转世界矩阵

2015-1-4 01:37| 发布者: 杨炎| 查看: 2239| 评论: 0|原作者: 蛮牛|来自: yzc88亚洲城脚本manual

摘要: camera.cameratoworldmatrix 相机转世界矩阵varcameratoworldmatrix:matrix4x4description描述matrix that transforms from camera space to world space (read only).从相机空间到世界空间的变换矩阵(只读)。use ...

camera.cameratoworldmatrix 相机转世界矩阵

varcameratoworldmatrix: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轴正向。

c#

javascript

using unityengine;

using system.collections;

public class example :monobehaviour{

public float distance = -1.0f;

void ondrawgizmosselected() {

matrix4x4m = camera.cameratoworldmatrix;

vector3(0, 0, distance));

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(0,0,distance));

gizmos.color=color.yellow;

gizmos.drawsphere(p, 0.2);

}

相关阅读

文章点评
相关文章