0 votes

For my staticbody I have 2 collisionshape2d and when I instance the scene at the same place it causes lag because having to many collisionshape2ds in 1 place leads to a lot of collision pairs. Having 150 instances leads to 45000 collision pairs and the fps decreases to single digits. How can I make the Collisionshape2d 1 and Collisionshape2d 2 not collide which will decrease the number of collision pairs by a lot.

-Collisionshape2d 1
--Collisionshape2d 2

asked Aug 14, 2019 in Engine by jujumumu (259 points)

2 Answers

+1 vote
Best answer

Depending on your setup, you could use collision layers. Most of the time this will work. Just set each to be on a different layer, and make sure you have the things it should collide with on that same layer as well.

answered Aug 14, 2019 by andersmmg (282 points)
selected Aug 14, 2019 by jujumumu

Collisionshape2d 1 should not collide with Collisionshape2d 2. Collisionshape2d 1 should not collide with itself. Collisionshape2d 2 should not collide with itself. And then I have the player which should collide with Collisionshape2d 2 but not Collisionshape2d 1. I have doubts to this solution because I already set the layers so that Collisionshape2d 1 does not collide but they still have collision pairs.

Could you tell me what layer each object is on?

Looking further I do not think you can change the layers for collisionshape2d only for the staticbody so there is no way to make some collisionshape2d not collide. There still might be??

You can only change the static body layer

+1 vote
answered Aug 14, 2019 by Eric Ellingson (1,513 points)
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.