Created
September 13, 2018 11:33
-
-
Save nabesi777/1c686d19a8ddc6624bbb0c1f5421a2c6 to your computer and use it in GitHub Desktop.
Face_To_Camera_2 C#
This file contains hidden or 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 System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class FaceTo : MonoBehaviour { | |
public GameObject cube; //cubeを入れる箱を作成 | |
public Camera mainCamera; //カメラを入れる箱を作成 | |
// Use this for initialization | |
void Start () { | |
} | |
// Update is called once per frame | |
void Update () { | |
//カメラをcubeの方向へ向ける transform.LookAT | |
//transform.LoolAt関数はオブジェクトを対象の方向へ向ける | |
mainCamera.transform.LookAt(cube.transform); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment