Exemple #1
0
    private void Grab()
    {
        if (overlapped != null)
        {
            CustomTag ct = overlapped.GetComponent <CustomTag>();
            if (ct != null && ct.HasTag("grabbable"))
            {
                hasGrabbed = true;
                //overlapped.gameObject.transform.position = contact.transform.position;
                joint = overlapped.gameObject.AddComponent <FixedJoint2D>();
                joint.connectedBody = transform.root.GetComponent <Rigidbody2D>();

                grabbedObject = overlapped.gameObject;
                ct.AddTag("grabbed");
            }
        }
    }