Unity Recipes - Look Toward Direction of Velocity

The following C# script for Unity can be used to make an object look toward the direction of its current velocity.

using System.Collections; using System.Collections.Generic; using UnityEngine; public class MyController : MonoBehaviour { private void Update() { lookTowardDirectionOfVelocity(); } void lookTowardDirectionOfVelocity() { transform.rotation = Quaternion.LookRotation(player.GetComponent().velocity); } }