+1 vote

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.

Staticbody
-Sprite
-Collisionshape2d 1
-Area2d
--Collisionshape2d 2

in Engine by (451 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.

by (648 points)
selected by

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
by (1,656 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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.