コード例 #1
0
    private void OnCollisionEnter(Collision collision)
    {
        membreCollant.isCollision = true;
        GameObject objectCollision;

        try
        {
            objectCollision = collision.collider.attachedRigidbody.gameObject;
        }
        catch (System.NullReferenceException)
        {
            objectCollision = collision.gameObject;
        }
        Debug.Log(this.name + " touch " + objectCollision.name + " and his tag is " + objectCollision.tag);
        if (!objectCollision.CompareTag(this.tag) && objectCollision != null)
        {
            membreCollant.SetTouch(objectCollision, collision.GetContact(0).point);
        }
    }
コード例 #2
0
 private void OnCollisionEnter(Collision collision)
 {
     membreCollant.isCollision = true;
     membreCollant.SetTouch(collision.gameObject, collision.GetContact(0).point);
 }