Documentation index for AI agents (llms.txt) A Markdown version of every page is available: request the page's source under /docs/, follow the "alternate" link in this page's head, or start from /llms.txt.
Visual Script logo Manual

On Collision Enter 3D#

Physics 3D / On Collision Enter 3D

Description#

Executed when a game object collides with another collider with a Rigidbody

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Title("On Collision Enter 3D")]
    [Image(typeof(IconCollision), ColorTheme.Type.Lime, typeof(BadgeArrowRight))]
    
    [Description("Executed when a game object collides with another collider with a Rigidbody")]
    [Category("Physics 3D/On Collision Enter")]
    
    [Keywords("Collider")]

    [Serializable]
    public class TriggerCoreCollisionEnter3D : TriggerHandleSourceBase<HandleOnCollisionEnter3D>
    {
        // EXPOSED MEMBERS: -----------------------------------------------------------------------

        [SerializeField]
        private TValueOrAny<GetGameObject> m_Collide = new TValueOrAny<GetGameObject>();
        
        // PROPERTIES: ----------------------------------------------------------------------------

        protected override string GetTitle(GameObject source) => $"{this.SourceName} Collision Enter {this.m_Collide}";

        // OVERRIDE METHODS: ----------------------------------------------------------------------
        
        protected override void OnTrigger(GameObject target)
        {
            using Args args = Args.Get(this.Component, target);
            if (this.m_Collide.IsSpecific && this.m_Collide.Value.Get(args) != target) return;
            
            this.Run(args);
        }
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.