| target | 向ける対象オブジェクト |
| worldUp | 上方ベクトルを指定 |
対象の Transform を設定し、その方向へと向かせます
worldUp ベクトルが上方ベクトルの方向となり、回転を変更します。
worldUp パラメーターを省略した場合、関数はワールドの Y 軸を使用します。
worldUp はベクトルのヒントのためだけに使用します。前方ベクトルが worldUp に対して垂直である場合、回転の上方ベクトルは worldUp ベクトルとのみ一致します。
// This complete script can be attached to a camera to make it // continuously point at another object. // Thetargetvariable shows up as a property in the inspector. // Drag another object onto it to make the camera look at it. using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { public Transform target; void Update() { // Rotate the camera every frame so it keeps looking at the target transform.LookAt(target); } }
| worldPosition | 向かせるポイント |
| worldUp | 上方ベクトルを指定 |
worldPosition の方向へと向かせます
worldUp ベクトルが上方ベクトルの方向となり、回転を変更します。
worldUp パラメーターを省略した場合、関数はワールドの Y 軸を使用します。
worldUp はベクトルのヒントのためだけに使用します。前方ベクトルが worldUp に対して垂直である場合、回転の上方ベクトルは worldUp ベクトルとのみ一致します。
// Point the object at the world origin transform.LookAt(Vector3.zero);
// Point the object at the world origin transform.LookAt(Vector3.zero);