AutoA.cs 835 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class AutoA : MonoBehaviour
  5. {
  6. GameObject LuoGan04;
  7. Vector3 LuoGan04Aim = new Vector3(37.71f, 4.74f, -22.0f);
  8. Quaternion LuoGan04Qua = new Quaternion(0.0f, 0.0f, 0.0f, 0.0f);
  9. // Use this for initialization
  10. void Start()
  11. {
  12. LuoGan04 = GameObject.Find("04_LuoGan");
  13. print(LuoGan04.name);
  14. }
  15. // Update is called once per frame
  16. void Update()
  17. {
  18. print("000000000p" + LuoGan04.transform.localPosition);
  19. print("1111111111111p" + LuoGan04Aim);
  20. print("2222222222222p" + (LuoGan04.transform.localPosition - LuoGan04Aim).magnitude);
  21. if (Mathf.Sqrt((LuoGan04.transform.localPosition - LuoGan04Aim).magnitude) < 1.5)
  22. {
  23. LuoGan04.transform.localPosition = LuoGan04Aim;
  24. LuoGan04.transform.localRotation = LuoGan04Qua;
  25. }
  26. }
  27. }