유니티 심화

Vector

다모아 2023. 8. 17. 16:25
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Cam : MonoBehaviour
{
    [SerializeField]
    private Button btn;
    [SerializeField]
    private Transform targetTrans;
    [SerializeField]
    private Transform zoomInPoint;
    [SerializeField]
    private Transform zoomOutPoint;
    // Start is called before the first frame update
    void Start()
    {
        this.btn.onClick.AddListener(() => {
            Debug.Log("클릭");
            this.transform.LookAt(this.targetTrans.position);

            DrawArrow.ForDebug(this.transform.position, this.transform.forward * 3f, 10f, Color.blue, ArrowType.Solid);
            this.zoomInPoint.position = this.transform.position + this.transform.forward * 3f;

            DrawArrow.ForDebug(this.transform.position, -this.transform.forward * 3f, 10f, Color.blue, ArrowType.Solid);
            this.zoomOutPoint.position = this.transform.position + -this.transform.forward * 3f;
        });
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}

'유니티 심화' 카테고리의 다른 글

Vector3.normalized  (0) 2023.08.18
Lerp, 줌인, 줌아웃, LookAt, 카메라 팔로잉  (0) 2023.08.17
잘못만든 카메라 세팅  (0) 2023.08.17
Lerp  (0) 2023.08.17
카메라 세팅  (0) 2023.08.17