예제 #1
0
    void PickUp()
    {
        RaycastHit hit;

        if (Physics.Raycast(cam.transform.position, cam.transform.forward, out hit, grabDistance))
        {
            Grabbable item = hit.transform.GetComponent <Grabbable>();
            if (item != null)
            {
                item.ForceRelease();
                grabbedItem = item;
                grabbedItem.Grab(this);
            }
        }
    }