找回密碼
 注冊帳號

掃一掃,訪問微社區

camera.screentoworldpoint 屏幕轉世界位置

2015-1-4 07:37| 發布者: 楊炎| 查看: 2476| 評論: 0|原作者: 蠻牛|來自: unity3d腳本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);

}

文章點評
极速时时彩开奖最快的网站