Skip to content

Minimal reproduction of a collision bug I encountered

Notifications You must be signed in to change notification settings

Emynator/GodotCollisionBug

Repository files navigation

This is a demonstration of a collision bug in Godot.

A scene is setup with 4 Area2Ds with a size of 512x512 placed around the origin. In the main scene this scene is instantiated and a CharacterBody2D with it's CollisionShape2D initially disabled is also instantiated. The CharacterBody2D is set to position (256, 256) and then it's CollisionShape2D is enabled with a SetDeferred() call.

Expected behaviour: only one Area2D's OnBodyEntered() function is triggered. Actual behaviour: all 4 Area2D's OnBodyEntered() function is triggered, then the other 3 Area2D's OnBodyExited() function is triggered.

Pressing spacebar calls a reload function which frees the test scene and the test object and instantiates new ones. The wrong behaviour occurs again.

Reproduceable in:

  • Godot Engine v4.3.dev3.mono.official [36e943b6b]
  • Godot Engine v4.2.1.stable.mono.official [b09f793f5]
  • Godot Engine v4.1.3.stable.mono.official [f06b6836a]
  • Godot Engine v4.0.4.stable.mono.official [fc0b241c9]

Feel free to clone the repo and play around with the code.

About

Minimal reproduction of a collision bug I encountered

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published