From 9c402140bdd2946a64db147f10aadc8bf8a87251 Mon Sep 17 00:00:00 2001 From: Mergul Date: Mon, 1 Mar 2021 12:25:52 +0100 Subject: [PATCH] -fixed BrickBreaker issue with self collision --- demos/source/demos/brick_breaker.d | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/demos/source/demos/brick_breaker.d b/demos/source/demos/brick_breaker.d index 637415c..51e213c 100644 --- a/demos/source/demos/brick_breaker.d +++ b/demos/source/demos/brick_breaker.d @@ -192,6 +192,7 @@ struct BallCollisionSystem { bool test(EntityID id) { + if(id == data.entity[i].id)return true; Entity* entity = launcher.manager.getEntity(id); if(entity) { @@ -311,7 +312,8 @@ struct BrickBreakerDemo __gshared const (char)* tips = "Brick breaker demo. It's a game about destroying evil bricks. This demo is usnfinished yet but collision works well. Bricks can be destroyed. Spawning thousands of bricks and then thousands of balls is good way to try demo. -Bricks uses StaticBVH, ball don't collide witch each other, paddle is added to dynamic BVH and collide with balls. But nothing keeps you from adding dynamic collision for balls."; +Bricks uses StaticBVH, ball don't collide witch each other, paddle is added to dynamic BVH and collide with balls. But nothing keeps you from adding dynamic collision for balls. +Currently dynamic collisions are pretty slow as dynamic BVH is rebuilded every frame on single thread."; //EntityTemplate* tmpl; Texture texture;