---
tags:
    - "Physics, 2D"
---

# Rigidbody 2D Is Touching

[Physics 2D](../index.md) / [Rigidbody 2D](index.md) / **Rigidbody 2D Is Touching** Collider

<div class="grid cards" markdown>

* :green_circle: Can Read

* :red_circle: Cannot Write

</div>

## Description

Returns the execution of Is Touching method on the Rigidbody 2D component

## Code

```cs
// <auto-generated>
// This script was automatically generated using the Visual Script Transpiler.
// Do not modify. Changes to this file will be lost when updating the package.
// </auto-generated>

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]

    [Title("Rigidbody 2D Is Touching")]
    [Category("Physics 2D/Rigidbody 2D/Is Touching", "Collider")]
    [Description("Returns the execution of Is Touching method on the Rigidbody 2D component")]

    [Image(typeof(IconPhysics), ColorTheme.Type.Lime, typeof(Badge2D))]
    [Keywords("Physics, 2D")]

    [Serializable]
    public class GenTypeBool_Rigidbody2D_IsTouching_1_Collider2DCollider : TypeBool
    {
        [SerializeField] private GetGameObject m_Rigidbody2D = new GetGameObject(
            new GenTypeGameObject_Rigidbody2D()
        );

        [SerializeField] private GetGameObject m_Collider = new GetGameObject();

        public override bool Get(Args args)
        {
            Rigidbody2D component = this.m_Rigidbody2D.Get<Rigidbody2D>(args);
            if (component == null) return default;

            bool value = (bool) component.IsTouching(
                (Collider2D) this.m_Collider.Get<Collider2D>(args)
            );

            return value;
        }

        public override string ToString()
        {
            return $"{this.m_Rigidbody2D} Is Touching ({this.m_Collider})";
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}
```

