Home > Back-end >  How do I detect collisions in a 2D project in Unity (without using a RigidBody2D)?
How do I detect collisions in a 2D project in Unity (without using a RigidBody2D)?

Time:11-04

I'm trying my hands on Unity for the first time and, as a "hello-world" kind of project I'm aiming for a 2D "Asteroids" game.

I'm advancing well, but the collisions are causing me headaches. They don't register. I've tries with and without a RigidBody. But The RB forced me to set it to Kinematic as it would otherwise fall down due to gravity, which is not what I want in a top-down shooter.

I tried setting "Full Kinematic Contacts" without any luck.

There are many different possible combinations and I can't find the right one. Rigid Body or not? Collider or not? Maybe both?

Here's a little demo project that reproduces the issue. I would expect it to show a log-line in the console when the circle touches the square. But it does not. How do I get that done?

enter image description here Here is the doc link: https://docs.unity3d.com/ScriptReference/Rigidbody-velocity.html

Thanks

  • Related