LoginSignup
0
0

More than 3 years have passed since last update.

【LookAt関数】オブジェクトAが、指定のオブジェクトBを常に向くスクリプト【テンプレスクリプト】

Last updated at Posted at 2020-12-25

下記スクリプトがアタッチされたオブジェクトは、
targetObjectで指定されたオブジェクトの方向を常に向くようになります。

LookAt.cs
using UnityEngine;
public class LookAt : MonoBehaviour
{
    public GameObject targetObject;
    void Update()
    {
        this.transform.LookAt(targetObject.transform);
    }
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0