camera.screentoworldpoint 屏幕转世界位置

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

摘要: camera.screentoworldpoint 屏幕转世界位置functionscreentoworldpoint(position:vector3description描述transforms position from screen space into world space.从屏幕空间到世界空间的变化位置。screenspace is ...

camera.screentoworldpoint 屏幕转世界位置

functionscreentoworldpoint(position:vector3

description描述

transforms position from screen space into world space.

从屏幕空间到世界空间的变化位置。

screenspace 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的位置是以世界单位衡量的到相机的距离。

c#

javascript

using unityengine;

using system.collections;

public class example :monobehaviour{

void ondrawgizmosselected() {

vector3(100, 100, camera.nearclipplane));

gizmos.color=color.yellow;

gizmos.drawsphere(p, 0.1f);

}

}

// draw a yellow sphere in the scene view at the position

// on the near plane of the selected camera that is

// 100 pixels from lower-left.

//在所选相机的近裁剪面上,绘制一个黄色的球,在左下100像素的位置

function ondrawgizmosselected () {

var p :vector3(100,100,camera.nearclipplane));

gizmos.color=color.yellow;

gizmos.drawsphere(p, 0.1);

}

文章点评