Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@hiyorin
Last active November 5, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiyorin/10435e5159371a67bea2 to your computer and use it in GitHub Desktop.
Save hiyorin/10435e5159371a67bea2 to your computer and use it in GitHub Desktop.
座標間の角度
using UnityEngine;
public class Example : MonoBehaviour
{
public Transform from = null;
public Transform to = null;
private void Update ()
{
// fromをtoへ向ける
Quaternion rotation = Quaternion.LookRotation (to.position - from.position);
to.rotation = rotation;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment