Beispiel #1
0
    public void Grab(Transform objectToGrab)
    {
        isHoldingSomething = true;
        isActive           = false;
        grabbedObject      = objectToGrab.gameObject;

        Vector3 contactNormal = (objectToGrab.position - transform.position).normalized;

        transform.rotation = Quaternion.LookRotation(contactNormal);

        objectToGrab.parent = transform;
        Rigidbody otherRB = objectToGrab.GetComponent <Rigidbody>();

        hookRb.mass += otherRB.mass;
        grabbedMass  = otherRB.mass;
        Destroy(objectToGrab.GetComponent <Obi.ObiRigidbody>());
        Destroy(otherRB);
        objectToGrab.GetComponent <Collider>().material = draggedObjectMaterial;

        grabParticles.Play();

        grapple.Grab(objectToGrab.GetComponent <Movable>());;
    }