示例#1
0
    void FixedUpdate()
    {
        if (this == null)
        {
            return;
        }
        Vector3    newPosition = transform.position + rigidbody.velocity * Time.fixedDeltaTime;
        RaycastHit hit;

        if (Physics.Linecast(transform.position, newPosition, out hit))
        {
            if (hit.collider.gameObject != Owner.gameObject)
            {
                AttachmentController isAttachment = hit.collider.GetComponent <AttachmentController>();
                if (isAttachment == null || !isAttachment.IsParentOf(Owner))
                {
                    OnCollision(hit.collider, hit.point, hit.normal);
                }
            }
        }
    }