|Topic was automatically imported from the old Question2Answer platform.
Hi, i have an area that will apply some velocity to other areas inside. For example the wind effect.
I’m trying with area_entered, and area_exited signals from area, i add to some array and then in the process i apply this velocity. but i have a problem.
As you can see, when enters, prints inside and start moving, but when is full inside and collides with the other side of the area, it prints exited. I need to know what items are inside this area to apply the velocity each frame.
Here is the code:
First is the answer to your question:
get_overlapping_bodies() so you don’t need
- Make sure you change the
collision_mask in the
Inspector accordingly so the area only detects the player
for area in $AirArea.get_overlapping_areas():
- It seems that you have the
Player scene as a
Node2D with a
Area2D as children
- That makes the
Area2D move without moving the
- So you should make the
Area2D with a
Sprite as a child
Make Scene Root
You are right, I can use get_overlapping_areas, but this not solves my problem. It works with exactly same behavior, when my player area is full inside it stops. I found the solution, Check my answer for the solution if you are curious.
Raikish | 2019-03-05 15:25
I found the solution in CollisionPolygon2D properties.
I don’t know why but, when I created the CollisionPoligon2D build mode was segments by default. I have 0 idea about how this works but, when I changed to Solids build mode it becomes to work as expected.
I will add a .GIF to show it.