ChangeHand.cs 484 B

12345678910111213141516171819
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class ChangeHand : MonoBehaviour
  5. {
  6. public GameObject shoubi1;
  7. public GameObject shoubi2;
  8. public GameObject zhongduan;
  9. // Update is called once per frame
  10. void Update()
  11. {
  12. Vector3 p1 = (shoubi1.transform.position + shoubi2.transform.position)/2;
  13. zhongduan.transform.position = p1;
  14. zhongduan.transform.LookAt(shoubi1.transform, Vector3.down);
  15. }
  16. }