Skip to content

Writing a tilemap's custom data disables Area2D collision for the current frame #112973

@BlueberryGecko

Description

@BlueberryGecko

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:

  1. The script attached to the Tilemap toggles the bool value has_severe_commitment_issues every frame inside _process.
Image
  1. 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.
  2. 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.
  3. 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:

Image

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 chanceToWrite to 1 resp. 0 in the MRP and see where the ball ends up.)

Minimal reproduction project (MRP)

custom-data-physics-mrp_2025-11-19.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Status

    For team assessment

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions