Operating system or device, Godot version, GPU Model and driver (if graphics related):
Godot 3.0 alpha 2 Mono version
Issue description:
Expecting raycasts to ignore disabled collision shapes. Unless there is a different usage in mind?
@Boothand could you confirm if this was working correctly in 2.x?
Also please provide small reproduction project. It's not much work, but it helps a lot.
Raycast disabled collider example.zip
In 2.1, there is no 'Disabled' flag on the CollisionShape2D, so don't know how to compare.
@Boothand, Oh I see. So it's a new feature and a new bug :)
We have now entered release freeze for Godot 3.0 and want to focus only on release critical issues for that milestone. Therefore, we're moving this issue to the 3.1 milestone, though a fix may be made available for a 3.0.x maintenance release after it has been tested in the master branch during 3.1 development. If you consider that this issue is critical enough to warrant blocking the 3.0 release until fixed, please comment so that we can assess it more in-depth.
I won't need it personally (don't have time for Godot for a while) but I'd argue it's gameplay critical. Something that is not supposed to have collision in various states will be considered by raycasts, and working around it could be pretty troublesome, unless there is a way to 'raycast all' and manually skip every collider that is set to disabled. Sorry I don't have time to gear up and look into this now though.
I can confirm this problem is still here, which completely breaks my game because my object has different collision bodies for when he ducks and other actions. These are all disabled but raycasting still picks up all the shapes. It would be GREAT if this could be fixed.
Got that issue as well today. I worked around it by scaling my collision to 0.
get_node("CollisionShape2D").scale = Vector2(0, 0) # Hack/Workaround for disabling the collision
Edit: Not a great workaround, doesn't apply to all scenarios. Fix would be greatly appreciated :slightly_smiling_face:
For me what works as a temporary workaround is to switch the collision_layer to something that I do not use when I want it disabled.
Tested in master cff89fc and could not reproduce. I remember there being a commit that removed disabled shapes from physics entirely so that might've fixed it.
3.0.6 the bug is still there, and it's pretty critical =(
Can't reproduce any longer, so closing.
I am not sure what fixed this in master though so it could be backported, @hpvb may have an idea?
Else let me know and I could try looking for it.
(i did not fix it btw, at least not willingly)
I'll check what fixed it in the master branch.
Found it, it was fixed by #17151.
Most helpful comment
I can confirm this problem is still here, which completely breaks my game because my object has different collision bodies for when he ducks and other actions. These are all disabled but raycasting still picks up all the shapes. It would be GREAT if this could be fixed.