Beispiel #1
0
    public override void OnRelease()
    {
        print("release");
        isGrabbed = false;
        GrabMgr.RemoveGrabbed(this.gameObject);
        this.transform.localScale = originalSize;               //maybe change this
        //this.transform.parent = player.gameObject.transform;

        this.GetComponent <Attractable>().setAttractable(true);
        Invoke("ResetCollider", 1f);    //prevents being stuck in player collider....most of the time
    }
Beispiel #2
0
    public override void OnRelease()
    {
        print("release");
        isGrabbed = false;
        GrabMgr.RemoveGrabbed(this.gameObject);

        this.GetComponent <Attractable>().setAttractable(true);
        this.GetComponent <BallRespawner>().SetHolding(false);
        AddThrowForce();
        // player.transform.TransformVector(OVRInput.getlo)
        activeHand = -1;
        Invoke("ResetCollider", 1f);    //prevents being stuck in player collider on release....most of the time
    }
Beispiel #3
0
    public void SnapObject()
    {
        print("Snap");
        isSnapped = true;
        //playSound here
        if (gos != null)
        {
            GameObject[] objs = gos;
            foreach (GameObject go in objs)
            {
                if (GrabMgr.getGrabbed().Contains(go))
                {
                    GrabMgr.RemoveGrabbed(go);
                }

                //go.GetComponent<BGrab>().SetTestTrigger(true);
                //go.GetComponent<BridgePieceGrab>().OnRelease();
                go.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY
                                                            | RigidbodyConstraints.FreezeRotationZ | RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezePositionY
                                                            | RigidbodyConstraints.FreezePositionZ;

                go.GetComponent <Attractable>().setAttractable(false);
                // go.GetComponent<BridgePieceGrab>().ResetSize();

                go.GetComponent <Renderer>().material.color = go.GetComponent <MagicBoxGrab>().GetColor();

                go.GetComponent <MagicBoxGrab>().GrowObject();
                // this.GetComponentInChildren<AttachOrientationCorrection>().AdjustOrientation();
                go.layer = 10; ///makes object ground for gravity calculations
            }
        }
        if (curObject[0] != null)
        {
            for (int i = 0; i < curObject.Length; i++)
            {
                //curObject[i].GetComponent<Rigidbody>().isKinematic = true;

                Physics.IgnoreCollision(boxBase, curObject[i].GetComponent <BoxCollider>(), true);
                //Physics.IgnoreCollision(curObject[i].GetComponent<BoxCollider>(), this.GetComponentInChildren<BoxCollider>(), true);
            }

            snappedObject = curObject;
        }

        // this.GetComponentInChildren<BoxCollider>().enabled = true; //sets fake trigger so chair can stand on legs

        // AssemblyProgressCounter.S.IncrementSnap();
    }