Ejemplo n.º 1
0
    void FixedUpdate()
    {
        Vector3 lastPos = lastPositons[lastPositionsIdx];

        if (lastPos.Equals(transform.position))
        {
            return;
        }

        Vector3 dir = transform.position - lastPos;

        lastMoveDir = dir.normalized;

        lastPositionsIdx = (lastPositionsIdx + 1) % 2;
        lastPositons [lastPositionsIdx] = transform.position;

        if (target == null)
        {
            return;
        }


        bool bValid = target.AddForceAtVertex(vertexIdx, transform.position);

        if (bValid == true)
        {
        }
        else
        {
            // 达到最大形变量
            if (followForceSpingMax != null)
            {
                followForceSpingMax();
            }
            if (bLimitMove)
            {
                transform.position = lastPositons[lastPositionsIdx];
            }
        }
    }