SW 중심대학 OSS GIT 서버 박건태, 이승준, 고기완, 이준호 새로운 배포
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.1 KiB

4 years ago
  1. using ARLocation;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. public class DistanceTest : MonoBehaviour
  7. {
  8. public Text testText;
  9. public Text distanceText;
  10. // Start is called before the first frame update
  11. public GameObject mainOBJ;
  12. private void Start()
  13. {
  14. }
  15. // Update is called once per frame
  16. void Update()
  17. {
  18. var dis = (mainOBJ.transform.position - this.gameObject.transform.position);
  19. testText.text = "Distance is :" + dis;
  20. if (Vector3.Distance(mainOBJ.transform.position, this.gameObject.transform.position) <= 3)
  21. {
  22. distanceText.text = "now so far" + Vector3.Distance(mainOBJ.transform.position, this.gameObject.transform.position);
  23. }
  24. else
  25. {
  26. distanceText.text = "No is not far";
  27. }
  28. /*if(Vector3.Distance(mainOBJ.transform.position,this.gameObject.transform.position) <= 3)
  29. {
  30. Debug.Log("Near by OBJ");
  31. }
  32. else
  33. {
  34. Debug.Log("So far");
  35. }*/
  36. }
  37. }