拾取武器unity

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class wepon : MonoBehaviour {
    public Transform Lhand;
    public Transform Rhand;
    // Use this for initialization
    void Start () {
		
	}
	
    private void OnTriggerEnter(Collider other)
    {
        Debug.Log("hit:" + other.name);
        if(other.tag=="dao")
        {
            other.transform.parent = Lhand;
            other.transform.localPosition = Vector3.zero;
            other.transform.localEulerAngles = new Vector3(-90, 0, 0);
        }
        if (other.tag=="fuzi")
        {
            other.transform.parent = Rhand;
            other.transform.localPosition = Vector3.zero;
            other.transform.localEulerAngles = new Vector3(-90, 0, 0);
        }
    }

	// Update is called once per frame
	void Update () {
		
	}
}

猜你喜欢

转载自blog.csdn.net/weixin_41796913/article/details/84201876
今日推荐