void pin_rotate_ready()
    {
        //GameObject[] twoparticle = new GameObject[2];
        // Debug.Log("wang");
        ObiPinConstraints pins = this.GetComponent <ObiPinConstraints>();

        pins.RemoveFromSolver(null);
        ObiPinConstraintBatch batch = pins.GetFirstBatch() as ObiPinConstraintBatch;

        //attach more particle to pin
        kdtreesearch_left();
        for (int i = 0; i < 2; i++)
        {
            for (int j = 0; j < 26; j++)
            {
                batch.AddConstraint(particleindexsphere[i][j], twoobject[i].GetComponent <ObiCollider>(), Vector3.zero, 1.0f);
            }
            twoobject[i].GetComponent <ObiCollider>().Phase = 1;
            twoobject[i].AddComponent <ObjectDragger>();
            //Debug.Log(twoobject[i].transform.position);
        }
        batch.AddConstraint(centerparciel[0], twoobject[0].GetComponent <ObiCollider>(), Vector3.zero, 1.0f);
        batch.AddConstraint(centerparciel[1], twoobject[1].GetComponent <ObiCollider>(), Vector3.zero, 1.0f);
        pins.AddToSolver(null);
    }
    private IEnumerator AttachHook()
    {
        Vector3 localHit = curve.transform.InverseTransformPoint(hookAttachment.point);

        // Procedurally generate the initial rope shape (a simple straight line):
        curve.controlPoints.Clear();
        curve.controlPoints.Add(Vector3.zero);
        curve.controlPoints.Add(Vector3.zero);
        curve.controlPoints.Add(localHit);
        curve.controlPoints.Add(localHit);

        // Generate the particle representation of the rope (wait until it has finished):
        yield return(rope.GeneratePhysicRepresentationForMesh());

        // Pin both ends of the rope (this enables two-way interaction between character and rope):
        ObiPinConstraintBatch pinConstraints = rope.PinConstraints.GetFirstBatch();

        pinConstraints.AddConstraint(0, character, transform.localPosition, 0);
        pinConstraints.AddConstraint(rope.UsedParticles - 1, hookAttachment.collider.GetComponent <ObiColliderBase>(),
                                     hookAttachment.collider.transform.InverseTransformPoint(hookAttachment.point), 0);

        // Add the rope to the solver to begin the simulation:
        rope.AddToSolver(null);
        rope.GetComponent <MeshRenderer>().enabled = true;

        attached = true;
    }
Exemple #3
0
    private void AddPinConstraint(int ParticleIndexOne, int intParticleIndexTwo, ObiColliderBase obiCollider, Vector3 offSetOne, Vector3 offSetTwo)
    {
        pinConstraintBatch.AddConstraint(ParticleIndexOne, obiCollider, offSetOne, Quaternion.identity, 0);

        UpdateIndex();

        pinConstraintBatch.AddConstraint(intParticleIndexTwo, obiCollider, offSetTwo, Quaternion.identity, 0);
        UpdateIndex();
    }
Exemple #4
0
    private void SetPinConstraints(ObiCollider objectToStick, Vector3 normal)
    {
        pinConstraintBatch.RemoveConstraint(contraintIndexOne);
        UpdateIndex();
        pinConstraintBatch.RemoveConstraint(contraintIndexTwo);
        UpdateIndex();
        gameObject.SetActive(false);
        pinConstraintBatch.AddConstraint(particleIndexOne, objectToStick,
                                         objectToStick.transform.InverseTransformPoint(obiRope.GetParticlePosition(particleIndexOne) - transform.lossyScale.x * normal), Quaternion.identity, 0);

        //UpdateIndex();

        pinConstraintBatch.AddConstraint(particleIndexTwo, objectToStick,
                                         objectToStick.transform.InverseTransformPoint(obiRope.GetParticlePosition(particleIndexOne) - transform.lossyScale.x * normal + particlesDistance * normal), Quaternion.identity, 0);
        UpdateIndex();
        //obiCollider.ParentChange();
    }
Exemple #5
0
    /// <summary>
    /// MakeRope and AddPendulum may NOT be called on the same frame. You must wait for the MakeRope coroutine to finish first, as creating a rope is an asynchronous operation.
    /// Just adds a pendulum to the rope on the un-anchored end.
    /// </summary>
    public void AddPendulum(ObiCollider pendulum, Vector3 attachmentOffset)
    {
        // simply add a new pin constraint (see http://obi.virtualmethodstudio.com/tutorials/scriptingconstraints.html)
        rope.PinConstraints.RemoveFromSolver(null);
        ObiPinConstraintBatch batch = (ObiPinConstraintBatch)rope.PinConstraints.GetFirstBatch();

        batch.AddConstraint(pinnedParticle, pendulum, attachmentOffset, Quaternion.identity, 1);
        rope.PinConstraints.AddToSolver(null);
    }
    void pin_right()
    {
        rightpin++;
        ObiPinConstraints pins = this.GetComponent <ObiPinConstraints>();

        Debug.Log(pins.gameObject);
        pins.RemoveFromSolver(null);
        kdtreesearch_right();
        ObiPinConstraintBatch batch = pins.GetFirstBatch() as ObiPinConstraintBatch;

        for (int j = 0; j < 16; j++)
        {
            batch.AddConstraint(particleindexsphere[1][j], twoobject[1].GetComponent <ObiCollider>(), Vector3.zero, 1.0f);
        }
        //twoobject[0].GetComponent<ObiCollider>().Phase = 1;
        //twoobject[0].AddComponent<ObjectDragger>();
        batch.AddConstraint(centerparciel[1], twoobject[1].GetComponent <ObiCollider>(), Vector3.zero, 1.0f);
        pins.AddToSolver(null);
    }
Exemple #7
0
    void pinrotate_ready()
    {
        ObiPinConstraints pins = this.GetComponent <ObiPinConstraints>();

        pins.RemoveFromSolver(null);
        ObiPinConstraintBatch batch = pins.GetFirstBatch() as ObiPinConstraintBatch;

        kdtreesearch();
        for (int i = 0; i < 2; i++)
        {
            for (int j = 0; j < 16; j++)   //16 or 36 further testing
            {
                batch.AddConstraint(particleindexsphere[i][j], twoobject[i].GetComponent <ObiCollider>(), Vector3.zero, 1.0f);
            }
            twoobject[i].GetComponent <ObiCollider>().Phase = 1;
            //twoobject[i].AddComponent<ObjectDragger>();
            //Debug.Log(twoobject[i].transform.position);
        }
        batch.AddConstraint(centerparciel[0], twoobject[0].GetComponent <ObiCollider>(), Vector3.zero, 1.0f);
        batch.AddConstraint(centerparciel[1], twoobject[1].GetComponent <ObiCollider>(), Vector3.zero, 1.0f);
        pins.AddToSolver(null);
    }
Exemple #8
0
    public void GrabRope(InteractingInfo interactingInfo)
    {
        if (!isGrabbable)
        {
            return;
        }

        ObiPinConstraintBatch batch = pinConstraints.GetBatches()[0] as ObiPinConstraintBatch;

        pinConstraints.RemoveFromSolver(null);

        interactingInfo.pinIndex        = batch.ConstraintCount;
        interactingInfo.grabbedParticle = interactingInfo.touchingParticle;
        batch.AddConstraint(interactingInfo.grabbedParticle.Value, interactingInfo.obiCollider, interactingInfo.pinOffset, interactingInfo.stiffness);

        pinConstraints.AddToSolver(null);

        pinConstraints.PushDataToSolver();
    }
    IEnumerator DeployExtractionChute()
    {
        print("Deploy Extraction Chute");
        //add force component to extraction bag
        rbChuteBag             = chutes[0].AddComponent <Rigidbody>();
        rbChuteBag.useGravity  = true;
        rbChuteBag.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY;
        deploy = true;

        yield return(new WaitForSeconds(0.8f));

        pullChute = true;
        // remove the constraints from the solver, because we cannot modify the constraints list while the solver is using it.
        //detach rope from extraction bag
        ObiPinConstraintBatch constraintsBatch = rope.PinConstraints.GetFirstBatch();

        rope.PinConstraints.RemoveFromSolver(null);
        constraintsBatch.RemoveConstraint(0);
        rope.PinConstraints.AddToSolver(null);

        //create open parachute
        chutes[1] = (GameObject)Instantiate(models[2]);
        chutes[1].transform.parent     = payloads[0].transform;
        chutes[1].transform.position   = chutes[0].transform.position - new Vector3(0.0f, 0.0f, 0.0f);
        chutes[1].transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);

        //add box collider and obi collider components to parachute
        BoxCollider chuteBoxCollider = chutes[1].AddComponent <BoxCollider>();

        chuteBoxCollider.size   = new Vector3(1.0f, 1.0f, 0.2f);
        chuteBoxCollider.center = new Vector3(0, 0, -0.1f);

        //chuteObiCollider = new ObiCollider();
        chuteObiCollider = chutes[1].AddComponent <ObiCollider>();

        //attach rope to parachute
        constraintsBatch = rope.PinConstraints.GetFirstBatch();
        rope.PinConstraints.RemoveFromSolver(null);
        constraintsBatch.AddConstraint(0, chuteObiCollider, new Vector3(0, 0, -0.1f), 0.0f);
        rope.PinConstraints.AddToSolver(null);
        rope.PinConstraints.PushDataToSolver();

        //extraction bag falls after parachute is attached
        rbChuteBag.useGravity = true;

        rbParachute = chutes[1].AddComponent <Rigidbody>();
        rbParachute.AddForce(0.0f, 0.0f, -10.0f);
        rbParachute.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY |
                                  RigidbodyConstraints.FreezePositionY;

        yield return(new WaitForSeconds(1));

        Destroy(chutes[0]);

        rbParachute.constraints = RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezeRotationY |
                                  RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezePositionZ;

        deploy    = false;
        deployed  = true;
        pullChute = false;

        chutes[1].transform.parent = container;
    }
    public IEnumerator MakeRope()
    {
        print("Load Extraction Rope");
        ropeObject = new GameObject("rope",
                                    typeof(ObiSolver),
                                    typeof(ObiRope),
                                    typeof(ObiCatmullRomCurve),
                                    typeof(ObiRopeCursor));

        // get references to all components:
        ObiSolver solver = ropeObject.GetComponent <ObiSolver>();

        rope = ropeObject.GetComponent <ObiRope>();
        ObiCatmullRomCurve path = ropeObject.GetComponent <ObiCatmullRomCurve>();

        //ObiRopeCursor cursor = ropeObject.GetComponent<ObiRopeCursor>();

        // set up component references
        rope.Solver   = solver;
        rope.ropePath = path;
        rope.section  = (ObiRopeSection)Resources.Load("DefaultRopeSection");
        rope.GetComponent <MeshRenderer>().material = material;
        //cursor.rope = rope;

        // Calculate rope start/end and direction in local space: (plus offset)
        Vector3 localStart = transform.InverseTransformPoint(chutes[0].transform.position + new Vector3(0, 0.2f, 0));
        Vector3 localEnd   = transform.InverseTransformPoint(payloads[0].transform.position + new Vector3(0, 0.5f, 0));
        Vector3 direction  = (localEnd - localStart).normalized;

        // Generate rope path:
        path.controlPoints.Clear();
        path.controlPoints.Add(localStart - direction);
        path.controlPoints.Add(localStart);
        path.controlPoints.Add(localEnd);
        path.controlPoints.Add(localEnd + direction);

        //correct thickness, particle resolution, and parenting
        rope.thickness        = 0.025f;
        rope.resolution       = 0.05f;
        rope.transform.parent = payloads[0].transform;

        yield return(rope.StartCoroutine(rope.GeneratePhysicRepresentationForMesh()));

        rope.AddToSolver(null);

        //extractionCollider = new ObiCollider();
        //cargoCollider = new ObiCollider();

        BoxCollider extractionBox = chutes[0].AddComponent <BoxCollider>();

        extractionBox.size = Vector3.zero;
        BoxCollider cargoBox = payloads[0].AddComponent <BoxCollider>();

        cargoBox.center = new Vector3(0.0f, 0.25f, 0.0f);
        cargoBox.size   = new Vector3(0.5f, 0.5f, 0.5f);

        extractionCollider = chutes[0].AddComponent <ObiCollider>();
        cargoCollider      = payloads[0].AddComponent <ObiCollider>();

        // remove the constraints from the solver, because we cannot modify the constraints list while the solver is using it.
        rope.PinConstraints.RemoveFromSolver(null);
        ObiPinConstraintBatch constraintsBatch = rope.PinConstraints.GetFirstBatch();

        constraintsBatch.AddConstraint(0, extractionCollider, Vector3.zero, 0.0f);
        constraintsBatch.AddConstraint(rope.UsedParticles - 1, cargoCollider, new Vector3(0, 0.5f, -0.25f), 0.0f);
        rope.PinConstraints.AddToSolver(null);
        rope.PinConstraints.PushDataToSolver();
    }
    IEnumerator Setup()
    {
        extractionObject = (GameObject)Instantiate(models[0]);
        heavyCargoObject = (GameObject)Instantiate(models[1]);

        extractionObject.transform.position = initialExtractionPos;
        heavyCargoObject.transform.position = initialHeavyCargoPos;

        start = extractionObject.transform;
        end   = heavyCargoObject.transform;

        // Get all needed components and interconnect them:
        rope          = GetComponent <ObiRope>();
        path          = GetComponent <ObiCatmullRomCurve>();
        rope.Solver   = (ObiSolver)Instantiate(solver);
        rope.ropePath = path;
        rope.section  = section;
        GetComponent <MeshRenderer>().material = material;

        // Calculate rope start/end and direction in local space: (plus offset)
        Vector3 localStart = transform.InverseTransformPoint(start.position + new Vector3(0, 0.2f, 0));
        Vector3 localEnd   = transform.InverseTransformPoint(end.position + new Vector3(0, 0.5f, 0));
        Vector3 direction  = (localEnd - localStart).normalized;

        // Generate rope path:
        path.controlPoints.Clear();
        path.controlPoints.Add(localStart - direction);
        path.controlPoints.Add(localStart);
        path.controlPoints.Add(localEnd);
        path.controlPoints.Add(localEnd + direction);

        //correct thickness, particle resolution, and parenting
        rope.thickness        = 0.025f;
        rope.resolution       = 0.05f;
        rope.transform.parent = heavyCargoObject.transform;

        // Generate particles and add them to solver:
        yield return(StartCoroutine(rope.GeneratePhysicRepresentationForMesh()));

        rope.AddToSolver(null);

        // Fix first and last particle in place:
        //rope.invMasses[0] = 0;
        //rope.invMasses[rope.UsedParticles-1] = 0;
        //Oni.SetParticleInverseMasses(solver.OniSolver,new float[]{0},1,rope.particleIndices[0]);
        //Oni.SetParticleInverseMasses(solver.OniSolver,new float[]{0},1,rope.particleIndices[rope.UsedParticles-1]);

        constraints      = rope.GetComponent <ObiPinConstraints>();
        constraintsBatch = rope.PinConstraints.GetFirstBatch();

        extractionCollider = new ObiCollider();
        cargoCollider      = new ObiCollider();

        BoxCollider extractionBox = extractionObject.AddComponent <BoxCollider>();

        extractionBox.size = Vector3.zero;
        BoxCollider cargoBox = heavyCargoObject.AddComponent <BoxCollider>();

        cargoBox.center = new Vector3(0.0f, 0.5f, 0.0f);

        extractionCollider = extractionObject.AddComponent(typeof(ObiCollider)) as ObiCollider;
        cargoCollider      = heavyCargoObject.AddComponent(typeof(ObiCollider)) as ObiCollider;

        // remove the constraints from the solver, because we cannot modify the constraints list while the solver is using it.
        constraints.RemoveFromSolver(null);
        constraintsBatch.AddConstraint(0, extractionCollider, Vector3.zero, 0.0f);
        constraintsBatch.AddConstraint(rope.UsedParticles - 1, cargoCollider, Vector3.zero, 0.0f);
        constraints.AddToSolver(null);
        constraints.PushDataToSolver();
    }
Exemple #12
0
    // Update is called once per frame
    void Update()
    {
        if (!StaticData.isTapeAttachBothHands() && StaticData.getIsCut())
        {
            setControllerHighlight(CurState.singleAttach);
        }

        // after attach to both hands, show the first hint
        if (StaticData.isTapeAttachBothHands() && cur == 0)
        {
            // TODO: modify to handle different model

            // turn on the hint of trail renderer
            string modelName = StaticData.getTargetNumName();
            // GameObject.Find("fcum").transform.GetChild(0).gameObject.SetActive(true);
            GameObject.Find(modelName).transform.GetChild(0).gameObject.SetActive(true);

            // turn on step buttons
            hint[cur].GetComponent <MeshRenderer>().enabled = true;
            ParticleSystem particleSystem = hint[cur].GetComponent <ParticleSystem>();
            if (!particleSystem.isPlaying)
            {
                particleSystem.Play();
            }

            // turn on tooltips
            hint[cur].transform.GetChild(0).gameObject.SetActive(true);

            // turn on audio hint
            if (!audioHint[cur])
            {
                hint[cur].GetComponent <AudioSource>().Play(0);
                audioHint[cur] = true;
            }

            // set up highlighter
            setControllerHighlight(CurState.leftStep);
        }

        if (StaticData.isTapeAttachBothHands() && cur < hint.Length)
        {
            // set up highlighter
            if (cur < hint.Length - 1)
            {
                setControllerHighlight(CurState.leftStep);
            }
            else
            {
                setControllerHighlight(CurState.rightStep);
            }

            VRTK_InteractableObject stickBtn = hint[cur].GetComponent <VRTK_InteractableObject>();
            if (stickBtn.IsTouched())
            {
                ParticleSystem particleSystem = hint[cur].GetComponent <ParticleSystem>();
                if (!particleSystem.isStopped)
                {
                    particleSystem.Stop();
                }
                MeshRenderer color = stickBtn.GetComponent <MeshRenderer>();
                color.material = Resources.Load("activeBtn") as Material;
            }
            else
            {
                ParticleSystem particleSystem = hint[cur].GetComponent <ParticleSystem>();
                if (!particleSystem.isPlaying)
                {
                    particleSystem.Play();
                }
                MeshRenderer color = stickBtn.GetComponent <MeshRenderer>();
                color.material = Resources.Load("orange") as Material;
            }

            if (stickBtn != null && stickBtn.IsUsing())
            {
                // fix current position
                GameObject handler = getCurHandler();


                handler.transform.SetParent(stickPos[cur].transform);
                handler.transform.localPosition = new Vector3(0.0f, 0.0f, 0.0f);
                if (cur != hint.Length - 1)
                {
                    handler.transform.localRotation = Quaternion.Euler(new Vector3(0.0f, 0.0f, 0.0f));
                }
                handler.GetComponent <ObiParticleHandle>().enabled = true;


                // move on to next position
                leftController       = GameObject.Find("left_hand");
                leftCollider.enabled = true;


                ObiPinConstraints     pinConstraints     = obiCloth.GetComponent <ObiPinConstraints>();
                ObiPinConstraintBatch pinConstraintBatch = pinConstraints.GetFirstBatch();

                pinConstraints.RemoveFromSolver(null);


                // remove previous position constraints first
                // if (cur == 0)
                // {
                // do nothing
                // no constraint at the left hand side
                // }
                if (cur == 1)
                {
                    pinConstraintBatch.RemoveConstraint(3);
                    pinConstraintBatch.RemoveConstraint(2);
                }
                if (cur == 2)
                {
                    pinConstraintBatch.RemoveConstraint(3);
                    pinConstraintBatch.RemoveConstraint(2);
                }
                if (cur == 3)
                {
                    pinConstraintBatch.RemoveConstraint(1);
                    pinConstraintBatch.RemoveConstraint(0);
                }

                // add next position constraint
                if (cur == 0 || cur == 1)
                {
                    pinConstraintBatch.AddConstraint(leftAttachNode[cur * 2], leftCollider, offset, restDarboux, 1);
                    pinConstraintBatch.AddConstraint(leftAttachNode[cur * 2 + 1], leftCollider, offsetNeg, restDarboux, 1);
                }

                pinConstraints.AddToSolver(null);

                // turn off the current hint
                hint[cur].GetComponent <MeshRenderer>().enabled = false;
                ParticleSystem ps = hint[cur].GetComponent <ParticleSystem>();
                if (!ps.isStopped)
                {
                    ps.Stop();
                }
                hint[cur].transform.GetChild(0).gameObject.SetActive(false);

                ++cur;
                StaticData.setCurTapingStep(cur);

                // set up last step highlight
                if (cur == hint.Length - 1)
                {
                    setControllerHighlight(CurState.rightStep);
                }

                // turn on the next hint
                if (cur < hint.Length)
                {
                    hint[cur].GetComponent <MeshRenderer>().enabled = true;
                    ParticleSystem particleSystem = hint[cur].GetComponent <ParticleSystem>();
                    if (!particleSystem.isPlaying)
                    {
                        particleSystem.Play();
                    }

                    // turn on tooltip
                    hint[cur].transform.GetChild(0).gameObject.SetActive(true);

                    // turn on audio hint
                    if (!audioHint[cur])
                    {
                        hint[cur].GetComponent <AudioSource>().Play(0);
                        audioHint[cur] = true;
                    }
                }

                // Last step: use right hand to attach
                if (cur == hint.Length - 1)
                {
                    // set lefthand gesture unhold
                    setHandUnhold("[VRTK_SDKManager]/SDKSetups/SteamVR/[CameraRig]/Controller (left)/LeftController/VRTK_BasicHand/LeftHand");

                    rightHandler    = GameObject.Find("right_hand");
                    rightController = VRTK_DeviceFinder.GetControllerRightHand();
                }
            }
        }
        else if (StaticData.isTapeAttachBothHands() && cur >= hint.Length)
        {  // finish all steps
            // clear highlighter
            setControllerHighlight(CurState.finished);

            // set rightHand gesture unhold
            setHandUnhold("[VRTK_SDKManager]/SDKSetups/SteamVR/[CameraRig]/Controller (right)/RightController/VRTK_BasicHand/RightHand");

            // count 5 secs to reload main scene
            timeRemaining -= Time.deltaTime;
            if (timeRemaining <= 0)
            {
                Debug.Log("finish taping");
                SceneManager.LoadScene("testMain");
            }
        }
    }
Exemple #13
0
    private void OnTriggerEnter(Collider other)
    {
        if (!other.CompareTag("Cable"))
        {
            return;
        }
        ObiCollider obicollider = other.GetComponent <ObiCollider>();

        obiRope = other.transform.parent.GetComponentInChildren <ObiRope>();
        ObiPinConstraints pinConstrain = other.transform.parent.GetComponentInChildren <ObiPinConstraints>();

        pinConstraintBatch = pinConstrain.GetFirstBatch();

        Debug.Log("Total Particle" + obiRope.TotalParticles);
        Debug.Log("Used Particle" + obiRope.UsedParticles);
        Debug.Log("Pooled Particle" + obiRope.PooledParticles);

        foreach (var item in pinConstraintBatch.pinBodies)
        {
            Debug.Log(item.gameObject.name);
        }

        foreach (var item in pinConstraintBatch.pinIndices)
        {
            Debug.Log(item);
        }

        foreach (var item in pinConstraintBatch.GetConstraintsInvolvingParticle(particledex))
        {
            Debug.Log("Constrain of Last pariticle" + item);
        }

        pinConstrain.RemoveFromSolver(null);
        UpdateIndex();

        int CheckPoint = 0;

        Debug.Log("CheckPoin" + CheckPoint++);
        UpdateIndex();
        NameOfParticleLast  = pinConstraintBatch.pinBodies[LastParticleConstrainIndex].gameObject.name;
        NameOfParticleFirst = pinConstraintBatch.pinBodies[FirstParticleConstrainIndex].gameObject.name;

        if (other.name == NameOfParticleLast)
        {
            pinConstraintBatch.RemoveConstraint(LastParticleConstrainIndex);
            pinConstraintBatch.AddConstraint(obiRope.UsedParticles - 1, GetComponent <ObiColliderBase>(),
                                             transform.InverseTransformPoint(obiRope.GetParticlePosition(TestRope.UsedParticles - 1)), Quaternion.identity, 0);
            UpdateIndex();
            Debug.Log("CheckPoin" + CheckPoint++);
            pinConstraintBatch.RemoveConstraint(SecondLastParticleConstrainIndex);
            pinConstraintBatch.AddConstraint(obiRope.UsedParticles - 2, GetComponent <ObiColliderBase>(),
                                             transform.InverseTransformPoint(obiRope.GetParticlePosition(TestRope.UsedParticles - 2)), Quaternion.identity, 0);
            Debug.Log("CheckPoin" + CheckPoint++);
        }
        else if (other.name == NameOfParticleFirst)
        {
            pinConstraintBatch.RemoveConstraint(FirstParticleConstrainIndex);
            pinConstraintBatch.AddConstraint(0, GetComponent <ObiColliderBase>(),
                                             transform.InverseTransformPoint(obiRope.GetParticlePosition(0)), Quaternion.identity, 0);
            Debug.Log("CheckPoin" + CheckPoint++);
            UpdateIndex();
            pinConstraintBatch.RemoveConstraint(SecondParticleConstrainIndex);
            pinConstraintBatch.AddConstraint(1, GetComponent <ObiColliderBase>(),
                                             transform.InverseTransformPoint(obiRope.GetParticlePosition(1)), Quaternion.identity, 0);
        }

        pinConstrain.AddToSolver(null);
    }