godotengine / godotengine/godot

Collisions not working in @tool scripts

Open
#95,065 2 comments 0 reactions 0 assignees View on GitHub
discussion documentation enhancement topic:editor topic:physics
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in v4.3.rc2.official.3978628c6 and 4.2.2

### System information

Godot v4.3.rc2 - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2070 SUPER (NVIDIA; 31.0.15.5152) - Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz (8 Threads)

### Issue description

I have been unable to find any info in the docs that collisions are not intended to work with `@tool` scripts, so I assume they should. Seems like a pretty fundamental thing, so perhaps I am doing something wrong or missing something obvious.

In the example, at runtime, the collisions work as intended, but if you interactively drag the collider around in the editor with a `@tool` script, the collision signals don't trigger.

![Tool_collisions_not_working](https://github.com/user-attachments/assets/8d79f7d3-73c3-4bb5-b432-31e46751d24c)

Here is the script code for the signals...

![Tool_collisions_not_working_code](https://github.com/user-attachments/assets/49638086-4668-4b03-b2c4-4cb4e2f58313)

The attached example has two colliders, one is a Static body (square) and another Area2D (capsule). The Area2D circle overlaps them both and the collision signals fire correctly at runtime (see screenshot for output). But it does not work if I drag the circle over them in the editor. Shouldn't this work with `@tool` scripts?

### Steps to reproduce

- Run the example MRP project and you'll see in the output window that the collision signals trigger correctly
- However, if you pick up the Area2D_CIRCLE and move it in the editor, the signals do no fire. I believe the should with a `@tool` script. If they should not, this should be stated somewhere in the docs, but this seems very fundamental.

### Minimal reproduction project (MRP)

[Area2D_Tool_bug.zip](https://github.com/user-attachments/files/16471090/Area2D_Tool_bug.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.