Last active
December 7, 2017 03:07
-
-
Save chomado/b18bd4cb6668dbfc5a1466659688c8f7 to your computer and use it in GitHub Desktop.
Playerに追従するカメラ
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 System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class CameraController : MonoBehaviour | |
{ | |
public GameObject Player; | |
private Vector3 offset; | |
// Use this for initialization | |
void Start() | |
{ | |
this.offset = this.transform.position - this.Player.transform.position; | |
} | |
void LateUpdate() | |
{ | |
this.transform.position = this.Player.transform.position + this.offset; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment