1234567891011121314151617181920212223242526 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class FocusModelViewCtrl : MonoBehaviour
- {
- private Transform _focusTransform;
- private Camera _viewCamera;
- private bool _lookAtTarget=true;
-
- // Start is called before the first frame update
- void Start()
- {
- _viewCamera=Camera.main;
- }
- // Update is called once per frame
- void Update()
- {
- if (_lookAtTarget&&_focusTransform!=null)
- {
- _viewCamera.transform.LookAt(_focusTransform);
- }
- }
- }
|