30 lines
641 B
C#
30 lines
641 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class FollowCameraPosition : MonoBehaviour {
|
|
|
|
public Vector3 Yoffest = new Vector3(0,20,0);
|
|
public Transform Camera;
|
|
public MeshRenderer myRenderer;
|
|
private bool active;
|
|
|
|
void Start() {
|
|
myRenderer.enabled = false;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void LateUpdate () {
|
|
|
|
if (active != GameManager.GodMode)
|
|
{
|
|
active = GameManager.GodMode;
|
|
myRenderer.enabled = active;
|
|
}
|
|
|
|
transform.position = Camera.position + Yoffest;
|
|
Vector3 rot = transform.eulerAngles;
|
|
rot.y = Camera.eulerAngles.y;
|
|
transform.eulerAngles = rot;
|
|
}
|
|
} |