PhysicsShapeQueryParameters2D Detects Everything

Hi guys, I’m having some problems with the PhysicsShapeQueryParameters2D, I set the collision_mask of it to 1, so basically it should only detect the Player layer, but it’s not working as expected. It also can detect other layers

This is how I created the query

var query = PhysicsShapeQueryParameters2D.new()
var query.shape_rid = shape
var query.collide_with_areas = true
var query.collision_mask = 1

var result = get_world_2d().direct_space_state.intersect_shape(query, 1)

This is my Physics Layers

Need a bit more info. What is shape?

Also, have hit what looks like a bug in the 3D version of this, so it may be a bug here in 2D too.

I removed the code but the shape is like Circle or Rectangle, maybe Circle

Any idea guys?, do yall think this is a bug?, the collision of the query is created in the code but other collisions are inside the node, is that a problem?

Not sure exactly why it’s happening. I use the exact method in my code and it works.

For the time being, you can just check the result and react if the object detected is of a particular class.

Please try to give us more info to work on. Like, what’s in “result” and perhaps

Collision layer 1 is the default layer of all physics objects when they spawn that is not really a good layer to pick for your player. If you do not disable this layer on all other objects bitmasks when they are created in scenes or code of course the shape intersection will detect everything.