言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

Camera.WorldToScreenPoint

Switch to Manual
public function WorldToScreenPoint(position: Vector3): Vector3;

Description

Transforms position from world space into screen space.

スクリーン座標はピクセル単位で定義されています。画面の左下は(0,0)、右上は is (pixelWidth,pixelHeight). The z position is in world units from the camera.

	var target : Transform;

	function Update () {
		var screenPos : Vector3 = camera.WorldToScreenPoint (target.position);
		print ("target is " + screenPos.x + " pixels from the left");
	}