Godot: Area2D monitoring and monitorable are not working according to docs

Created on 26 Mar 2019  路  7Comments  路  Source: godotengine/godot

Godot version:
3.1. stable

OS/device including version:
Win7

Issue description:
My character scene has an _attack_Area2D_ with a _CollisionPoligon2D_ which I animate using the _AnimationPlayer_. My destructable scene has a _hitbox_Area2D_ with a _CollisionShape2D_ and a script for func _on_hitbox_area_entered(area): that is supposed to detect the overlapping _attack_Area2D_ of the character scene when the character's _Animationplayer_ turns the _attack_Area2D_ "on".

Everything is on the same collision layer and mask.

According to the docs, this should work:
I have just monitorableanimated on the character _attack_Area2D_, and monitoringon the destructable's hitbox. But it does not work. It is not detecting. Minimal Project:
https://github.com/golddotasksquestions/Collision_Detection-only_Monitorable
only-monitoring
The character is modulated darkred when his attack_Area2D is "hot". Meaning this is when his attack should destroy the destructables.

By the way:
Here, I have both monitoringand monitorableanimated via _AnimationPlayer_, while turned off by default. This works as intended, but I get the error !area_in && !E . Minimal Project:
https://github.com/golddotasksquestions/Collision_Detection-both_Monitorable_Monitoring
both-monitoring_monitorable

Here, I have monitorableand monitoringeverywhere on default, while the _CollisionPolygon2D_ is disabled and enabled via _AnimationPlayer_, which also does not work. It's not detecting either. Minimal Project:
https://github.com/golddotasksquestions/Collision_Detection-collpoly_disabled
collpol_disabeled

(related to this issue? https://github.com/godotengine/godot/issues/17812)

bug documentation physics

Most helpful comment

2019-11-06 00-22-17

I created another example: OnEnter.zip

Both enemy and player have monitoring and monitorable set to true.

Move the player over the enemy and both detect each other.

However once you enter the enemy and press Enter which disables the player's monitoring and monitorable, and press Enter again to re-enable, only the player detects the enemy.

Shouldn't the enemy detect the player now that the player's monitorable is true?

By pressing Space it disables the Area2D instead of changing monitoring or monitorable. Press again to re-enable and they both detect each other.

I would expect the behavior to be the same.

All 7 comments

I'm having exactly the same issue. I tried getting overlapping areas and it doesn't work either.
I haven't checked the source code but it's as if areas are only checked for overlaps when their active and they move.

I ended up manually switching monitoring/monitorable off and on to update overlapping areas array.

2019-11-06 00-22-17

I created another example: OnEnter.zip

Both enemy and player have monitoring and monitorable set to true.

Move the player over the enemy and both detect each other.

However once you enter the enemy and press Enter which disables the player's monitoring and monitorable, and press Enter again to re-enable, only the player detects the enemy.

Shouldn't the enemy detect the player now that the player's monitorable is true?

By pressing Space it disables the Area2D instead of changing monitoring or monitorable. Press again to re-enable and they both detect each other.

I would expect the behavior to be the same.

For anyone looking into this, CollisionShapes and CollisionPolygons are also only detected when moving: https://github.com/godotengine/godot/issues/34124
Now that I think about it, #34124 seems to the reasons why no collision is detected in the last minimal Project. If I enable the movement loop in the project, the enabled/disabeled CollisionShape is detected.

I'm closing this as I don't seem to be able to replicate this issue in Godot 3.2.stable any more. (Win)
If someone else still has it please let me know and comment, to reopen it.

I have to reopen this as monitorable and monitoring still don't seem to behave consistent in situations when both Areas are not moving:

u/Armanlex on Reddit pointed out that they still get a different behavour when they include position=position compared to when they don't include it (exit signal not firing when monitorable is turned off):

monitorable_behaviour1

The monitoring behaviour also does not seem to be consistent monitorable when turned on and off while not moving:

monitorable_monitoring_inconsist1

Minimal Project for anyone who would like to try:
MonitoringMonitorable_Armanlex.zip

Was this page helpful?
0 / 5 - 0 ratings