Blog post Purpose

The purpose of this short article is to showinstance a simple strategy for doing collision detection in Unity without the GameObject collisions impacting each various other through physics.

You watching: Unity collision without physics

Tbelow are plenty of ways to do collision detection in general, but this is the easiest way in Unity utilizing Unity"s built-in components.

See more: Probability Concepts In Engineering 2Nd Edition Pdf, Ang Y Tang Probabilityconceotinengineering Pdf

The Setup

We are going to store this example incredibly little to highlight just the necessary aspects. For this approach to work, you must use three components. The first 2 are Unity certain and also the 3rd is a tradition component:

Take note that there are 2D equivalents to all the aforementioned Unity certain components and also OnTrigger() approaches, you sindicate append 2D to their name.

Video Game Time

Now that we understand the components we’re going to be working via, let’s put up an easy instance. This step-by-action breakdown assumes you have opened up a new scene that consists of just the Main Camera that Unity automatically sets up. In enhancement you’ll desire to have included this CollisionScript component to your Project:making use of UnityEngine;making use of System.Collections;public class CollisionScript : MonoBehaviour personal void OnTriggerEnter(Collider that) Debug.Log(this + " entered " + that); Now sindicate follow along to these steps and also you’ll be up and running.

Add a Cube and also a Sphere to the scene (using Unity’s default 3D objects) By default, they will certainly have a BoxCollider and also SphereCollider component respectively, inspect the IsTrigger checkbox of each Multi-pick the Cube and the Sphere and also include a RigidBody component to both at the very same time With both still schosen, uninspect Use Gravity and check Is Kinematic With both still schosen, drag and also drop the CollisionScript into the Inspector Press Play Here"s a GIF showing the over steps in action:


You’ll notification that the Consingle logs 2 messperiods, one for the Cube and also one for the Sphere. You can select just among the objects now and usage the Transcreate Gizmo to simulate added collisions.


This is an easy example, however it illustprices the easy partnership in between a RigidBody that doesn’t use physics and also a Collider that offers triggers. The practice CollisionScript is somepoint you’ll desire to expand also on. Many likely you’ll desire the OnTrigger() techniques to dispatch a practice occasion that holds recommendations to both objects connected in the collision. Then you could have actually an occasion listener analyze the objects to identify what to perform following. Happy colliding.