Transform.forward, Vector3.forward

Unity3D 2021. 10. 20. 18:15
반응형

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Test : MonoBehaviour
{
    public Transform point;

    void Start()
    {
        this.transform.LookAt(point.position);
        DrawArrow.ForDebug(Color.blue, Vector3.zero, this.transform.forward);

        Debug.LogError(this.transform.forward);
        var pos = this.transform.TransformPoint(this.transform.forward);
        Debug.Log(this.transform.position);
        Debug.Log(pos);
        //DrawArrow.ForDebug(Color.blue, this.transform.position, pos);
        var dir = new Vector3(4.5f, 0, -3.1f) - new Vector3(3.7f, 0, -2.6f);
        DrawArrow.ForDebug(Color.blue, new Vector3(3.7f, 0, -2.6f), dir);

        Debug.LogError(this.transform.forward);

    }

    // Update is called once per frame
    void Update()
    {
        //this.transform.Translate(this.transform.forward * 1f * Time.deltaTime);   
    }
}
반응형
: