1234567891011121314151617181920 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class LookAt : MonoBehaviour
- {
- [SerializeField] private Transform m_Target = null;
- Transform m_Trans = null;
- private void Awake() {
- m_Trans = transform;
- }
- // Update is called once per frame
- void Update() {
- if (m_Target == null) return;
- m_Trans.LookAt(m_Target);
- m_Trans.eulerAngles = new Vector3(0, m_Trans.eulerAngles.y, 0);
- }
- }
|