0405 Magnitude 백터의 감산
2021. 4. 5. 17:15ㆍunity
using UnityEngine;
public class Cubecontroller : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
Vector3 endPos = new Vector3(11, 0, 9);
Vector3 currentPos = this.transform.position; //3,0,4
var dir = endPos - currentPos;
var len = dir.magnitude;
Debug.LogFormat("len: {0}", len);
var distasnce = Vector3.Distance(endPos, currentPos);
Debug.LogFormat("distance: {0}", distasnce);
}
}
'unity' 카테고리의 다른 글
0407 애니메이션 구현하기 (0) | 2021.04.07 |
---|---|
0407 화살 피하기 게임 (0) | 2021.04.07 |
0407 오브젝트 호출, 거리 계산, ui 반영, 사운드 삽입 (0) | 2021.04.07 |
0405 오브젝트 회전시키기 (0) | 2021.04.05 |
0405 기본 (0) | 2021.04.05 |