Raycast2D collides with disabled CollisionShape2D (Is it a bug?)

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

I’ve noticed that RayCast2D collides with CollisionShape2D even if the latter is disabled. I’m wondering if this is a bug.

To reproduce this, create a scene with the following structure:

    > RayCast2D
    > StaticBody2D
        >> CollisionShape2D

On CollisionShape2D, set disabled to true.

Add this script to your RayCast2D:

extends RayCast2D
func _process(delta):

Notice is_colliding() returns true despite the collision shape being disabled.

Is this a bug or intended behavior?

I seem to be having the same problem. Did you find a solution?

Arkinum | 2018-06-11 01:17

:bust_in_silhouette: Reply From: eons

Is a bug, see Raycast2D hits disabled collision shapes · Issue #12685 · godotengine/godot · GitHub

Probably fixed by Remove disabled shapes from physics 2D calculations by ShyRed · Pull Request #17151 · godotengine/godot · GitHub
Not sure if was already added or not to 3.0 but is on master (cherry pick tag).