Last active
November 5, 2015 14:24
-
-
Save hiyorin/10435e5159371a67bea2 to your computer and use it in GitHub Desktop.
座標間の角度
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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