using System.Collections; using System.Collections.Generic; using UnityEngine; public class camRandom : MonoBehaviour { [SerializeField] private Vector3 newlocation; [SerializeField] private bool viewObj = true; [SerializeField] private Transform customer; [SerializeField] private Space offsetPositionSpace = Space.Self; void Start() { newlocation.x = Random.Range(-2.0f, 2.0f); newlocation.y = Random.Range(2.0f, 3.0f); newlocation.z = Random.Range(-3.0f, 5.0f); } private void LateUpdate() { if (customer == null) return; if (viewObj) transform.LookAt(customer); else transform.rotation = customer.rotation; if (offsetPositionSpace!= Space.Self) transform.position = newlocation + customer.position; else transform.position = customer.TransformPoint(newlocation); } }