Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
Unityでゲーム開発 -JavaScript:Vector3とQuaternion-
[go: Go Back, main page]

Nanashi-softプログラマ専用Unityでゲーム開発


◇Unityでゲーム開発 -JavaScript:Vector3とQuaternion-

●Vector3
X,Y,Z座標を一まとめにしたものです
var a : Vector3 = Vector(「X座標」,「Y座標」,「Z座標」);

例)Vector3を使ってゲームオブジェクトに座標を設定する
var a : Vector3 = Vector3(0, 0, 0);
this.transform.position = a;

例)現在位置をVector3に代入する
var a : Vector3 = this.transform.position;


●Quaternion
クオータニオンは4×4の行列のことです
Unityでは,回転を行う際に使用するようです

・X軸を中心に回転
this.transform.rotation = Quaternion.AngleAxis(「角度」, Vector3.right);

・Y軸を中心に回転
this.transform.rotation = Quaternion.AngleAxis(「角度」, Vector3.up);

・Z軸を中心に回転
this.transform.rotation = Quaternion.AngleAxis(「角度」, Vector3.forward);


TOPプログラマ専用Unityでゲーム開発

Melonbooks DL