示例#1
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();
    }
示例#2
0
    public void ReleaseRope(InteractingInfo interactingInfo)
    {
        if (!isGrabbable)
        {
            return;
        }

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

        pinConstraints.RemoveFromSolver(null);

        if (interactingInfo.pinIndex.HasValue)
        {
            batch.RemoveConstraint(interactingInfo.pinIndex.Value);
        }

        pinConstraints.AddToSolver(null);

        pinConstraints.PushDataToSolver();
    }