Explorar el Código

Merge pull request #655 from Calinou/bullet-shower-no-check-collision-with-other-bullets

Don't check bullet collision with other bullets in the Bullet shower demo
Aaron Franke hace 3 años
padre
commit
44aefaecb6
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  1. 4 0
      2d/bullet_shower/bullets.gd

+ 4 - 0
2d/bullet_shower/bullets.gd

@@ -38,6 +38,10 @@ func _ready():
 
 
 		Physics2DServer.body_set_space(bullet.body, get_world_2d().get_space())
 		Physics2DServer.body_set_space(bullet.body, get_world_2d().get_space())
 		Physics2DServer.body_add_shape(bullet.body, shape)
 		Physics2DServer.body_add_shape(bullet.body, shape)
+		# Don't make bullets check collision with other bullets to improve performance.
+		# Their collision mask is still configured to the default value, which allows
+		# bullets to detect collisions with the player.
+		Physics2DServer.body_set_collision_layer(bullet.body, 0)
 
 
 		# Place bullets randomly on the viewport and move bullets outside the
 		# Place bullets randomly on the viewport and move bullets outside the
 		# play area so that they fade in nicely.
 		# play area so that they fade in nicely.