Collision - easy example is not working

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

Easy problem collision

Hi people!
I’m newbie.

I try to understand collision system in engine.

I created ease example: two objects with CollisionShape2D. I use VisualScript. I connected body_entered node and i added Print node. But when they overlarp collison event is not work, console is empty.
I’m moving Left player. It have func moving. Pressing key on keyboard “ArrowRight”.

Link file project.

What happend?
Please help me.

:bust_in_silhouette: Reply From: Aaron

Since both your hero and enemy are Area2Ds, you want to connect the area_entered signal instead of the body_entered signal. body_entered is only emitted when a PhysicsBody2D overlaps the area.

It’s work! Thank you! If I add PhysicsBody2D, will area_entered emit?

GearStarter | 2018-02-01 06:25

As I said, area_entered emits only when another Area2D overlaps. An overlapping PhysicsBody2D causes body_entered to emit instead.

Aaron | 2018-02-01 06:34

Ok. I replaced Aread2D with RigidBody2D and added body_eneterd node. Then I setted Mode Static. It’s not working.

Am I stupid?

GearStarter | 2018-02-01 07:10

That’s all. I decided it. I switched other Mode in RigidBody2D: Rigid, Character and Kinematic is working. But not is Static mode. Thank you.

GearStarter | 2018-02-01 10:06