How do I turn off area collisions through script (3D)?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DiAlEx

I’m basically trying to set the “disabled” property on a collision to “On” through a _on_Area_input_event but it isn’t working. The idea is to click on an object and enable the collision box in it so that an interaction can occur, but also to turn it off if one clicks outside that area. I’m calling the node through $"…/node and using “.disabled = true” or “false”

In what way isn’t it working? Is disabled set to false after your code has run?

SteveSmith | 2022-12-21 11:04

I try to set it to true to disable the collisions but they are unaffected by that.

DiAlEx | 2022-12-21 15:04

:bust_in_silhouette: Reply From: nexero

Disabling collision will also remove the ability to detect mouse pointer.
Instead of disabling it,
change the collision layer
set area2d property monitorable to false so other not won’t monitor it
set monitoring to false so it won’t monitor other body/area collision.

By using .monitorable = false and .monitoring = false?
EDIT: Seems to be working as intended now thanks.

DiAlEx | 2022-12-21 15:36