抓取代码

public class ZhuaZuoYePiao : MonoBehaviour {

    public bool IsOnce = true;
    public GameObject daimaoren;
    public GameObject zuoyepiao;

    void OnTriggerEnter(Collider other)
    {                       //抓取物体,把被抓物体归为子物体
        if (other.tag == "zuoyepiao")
        {
            other.transform.parent = this.gameObject.transform;         //把作业票作为手柄的子物体
            other.transform.localPosition = Vector3.zero;               //把作业票的自身位置归0,0,0;


            //解除物体之间的父子关系
            // other.gameObject.transform.parent.


            SoundController._instance.SetAudio(AudioClipType.duzuoyepiao);      //播放作业票内容
        }
        
    }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
  • 2022-12-23
  • 2022-12-23
  • 2021-12-31
  • 2021-07-29
猜你喜欢
  • 2022-12-23
  • 2021-11-30
  • 2021-08-19
  • 2021-06-11
  • 2021-11-27
  • 2022-02-02
  • 2021-08-27
相关资源
相似解决方案