Untitled

 avatar
unknown
plain_text
3 years ago
756 B
2
Indexable
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PuckupItemTest : MonoBehaviour
{

    public GameObject finger;
    private bool pickedUp = false;


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

    private void OnCollisionEnter(Collision collision)
    {

        Debug.Log("intra");
        Debug.Log(pickedUp);

        if (pickedUp)
        {
            return;
        }

        if (collision.gameObject.CompareTag("Sword"))
        {
            collision.gameObject.transform.position = finger.transform.position;
            collision.gameObject.transform.parent = finger.transform;
            pickedUp = true;
        }
    }

}