-
-
Notifications
You must be signed in to change notification settings - Fork 23.7k
Open
Labels
Description
Tested versions
- Godot_v4.4.1-stable_mono_linux_x86_64
- Godot_v4.5.1-stable_linux.x86_64
System information
Godot v4.5.1.stable.mono - Ubuntu 24.04.3 LTS 24.04 on X11
Issue description
Writing to a tilemap's custom data disables collision with Area2Ds only for the current frame.
In particular, if I write to custom tile data every frame, then:
- An Area2D's on_body_entered signal won't fire at all.
- RigidBody collides, but shows different physics results compared to when I don't do the writing. (a ball colliding with a bouncy tilemap will end up at a different spot)
- A CharacterBody collides correctly, but I assume it would show the same inconsistencies as RigidBody if I were to test more thoroughly
In the following video:
- The script attached to the Tilemap toggles the bool value
has_severe_commitment_issuesevery frame inside_process.
- This variable is entirely unrelated to anything else in the project, but causes the Area2D (godot icon with angry eyebrows) to pass right through the tilemap. The exception is frame 250, where I skip the write operation via script.
- I configured the Area2D's callback to destroy all colliding tiles, just to get some noticeable effect. Note that I set physics_quadrant_size to 1 for the project to be able to detect the colliding tile. This is unrelated to this issue.
- The RigidBody still bounces off, and the CharacterBody (godot icon with friendly eyebrows) still stops.
godot.mp4
You can also fiddle with a "random write chance" in the MRP I attached. If you put the writing chance to custom_data to a reasonably high value, but such that it is not written to every single frame, the Area2D will collide from time to time and leave some holes:
Steps to reproduce
- Create tilemap with custom data layer and physics
- connect an Area2D's on_body_entered to do something
- attach a script to the tilemap that writes some value to custom_data every frame.
- The Area2D's signal will never trigger. RigidBodies and probably also character bodies show slightly different physics behavior. (To test, you can set the Tilemap's
chanceToWriteto1resp.0in the MRP and see where the ball ends up.)
Minimal reproduction project (MRP)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status
Status
For team assessment