+1 vote

I am working in C# and am encountering a scenario where I need to set the layer/mask on a Node that could be a Area2D or a KinematicBody2D. Their common ancestor is CollisionObject2D, but I was surprised to find this class does not have a CollisionLayer or CollisionMask property. Turns out Area2D has it, and PhysicsBody2D has it, the only 2 classes that inherit from it. Is the engine duplicating code in these child classes? I can handle my scenario with extra functions, casting conditionals, etc, but it's dirty. Would be much easier if these classes could be combined, is there an active issue for this?

Edit: made an issue here - https://github.com/godotengine/godot/issues/26680

asked Mar 6, 2019 in Engine by jarlowrey (605 points)
edited Mar 6, 2019 by jarlowrey

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.