LookAt

確認済のバージョン: 4

-

難易度: 初級

LookAt 関数を使って、ゲームオブジェクトを他のゲームオブジェクトの方に向かせる方法を学びます。

LookAt

初級 Scripting

CameraLookAt

Code snippet

using UnityEngine;
using System.Collections;

public class CameraLookAt : MonoBehaviour
{
    public Transform target;
    
    void Update ()
    {
        transform.LookAt(target);
    }
}
#pragma strict

public var target : Transform;

function Update ()
{
    transform.LookAt(target);
}
import UnityEngine
import System.Collections


public class CameraLookAt(MonoBehaviour):

    public target as Transform

    
    private def Update():
        transform.LookAt(target)