Esempio n. 1
0
    private void FixedUpdate()
    {
        if (Physics.Linecast(prevPos, transform.position, out RaycastHit hit, mask))
        {
            Destroy(hit);


            //当たったものにBreakSystemがついてれば跡を残す
            BreakSystem bs = hit.transform.GetComponent <BreakSystem>();
            if (bs)
            {
                bs.BreakAtPoint(hit.point, null);
            }
        }

        prevPos = transform.position;
    }
Esempio n. 2
0
    /// <summary>
    /// 最初の線のリンク
    /// </summary>
    /// <param name="sta">検索開始点</param>
    /// <param name="end">検索終了店</param>
    /// <param name="mask">マスク</param>
    /// <param name="thisRB">開始点の所有者のリジッドボディ(ワイヤーアクションでひっぱるため)</param>
    public void SearchFuck(Vector3 sta, Vector3 end, Rigidbody thisRB)
    {
        if (Physics.Linecast(sta, end, out RaycastHit hit, mask))
        {
            Add(thisRB.transform, thisRB, -hit.normal, 0, thisRB.position, WIres, false);
            Add(hit.transform, hit.rigidbody, hit.normal, 0, hit.point, WIres, true);

            wireRange = currentWireRange;
            //当たったものにBreakSystemがついてれば跡を残す
            BreakSystem bs = hit.transform.GetComponent <BreakSystem>();
            if (bs)
            {
//                bs.BreakAtRay(hit);
                bs.BreakAtPoint(hit.point, null);
            }
        }
    }