Quaternion.SetLookRotation 注视旋转

function SetLookRotation (view : Vector3, up : Vector3 = Vector3.up) : void

Description描述

Creates a rotation that looks along forward with the the head upwards along upwards

创建一个旋转,沿着forward(z轴)并且头部沿着up(y轴)的约束注视。也就是建立一个旋转,使z轴朝向view  y轴朝向up。

Logs an error if the forward direction is zero.

如果forward方向是0,记录一个错误。

还没有添加代码
var obj1: Transform;
var obj2: Transform;
var q:Quaternion;
	
function Update() {
	q.SetLookRotation(obj1.position, obj2.position);
	transform.rotation=q;
}
Page last updated: 2011-1-16