Look At

Tutorial

·

Beginner

·

+10XP

·

5 mins

·

(2471)

Unity Technologies

Look At

How to make a game object's transform face another's by using the LookAt function.

This tutorial is included in the Beginner Scripting project.

Previous: Translate and Rotate

Next: Linear Interpolation

Languages available:

1. Look At

CameraLookAt

using UnityEngine;
using System.Collections;

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

Complete this tutorial