What is the difference between an Area2D and a CollisionShape2D node?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By camarones

I have recently come to Godot after using Unity and am trying to get to grips with the 2D nodes. Can someone explain to me the difference between the Area2D and the CollisionShape2D nodes? In my head they, both do the same thing and I don’t have a clear understanding of what makes them different.

Thanks

:bust_in_silhouette: Reply From: kidscancode

A collision shape is only a shape. It doesn’t do anything other than define an enclosed region. An Area2D is one of the CollisionObject2D types - things that can detect collisions.

When you add an Area2D, it doesn’t have a shape. Is it round, square, etc.? The CollisionShape2D lets you define that. Its name comes from the fact that it’s a shape which is added to collision objects.

I recommend you read this to get an understanding of the various collision and physics nodes:

I know it has been a while since the question was asked/answered. But my answer is that where Unity uses a simple checkbox for “is trigger” Godot uses an entirely different object.

Area2D is equivalent to an “is trigger” Collider2D in Unity.
CollisionShape2D is equivalent to a regular Collider2D in Unity.

-Mal

Maleke | 2019-03-06 16:25