RafaelBarbosatec / bonfire

(RPG maker) Create RPG-style or similar games more simply with Flame.
https://bonfire-engine.github.io
MIT License
1.18k stars 177 forks source link

[Bug]: When adding multiple HitBoxes, the second and subsequent tests are incorrect #511

Closed nyuntaka closed 1 month ago

nyuntaka commented 2 months ago

What happened?

When adding multiple HitBoxes, the second and subsequent tests are incorrect. I think this is a bug. hitbox0r hitbox1r hitbox2r

Steps to reproduce?

CollisionMapComponent collis = CollisionMapComponent(
      position: Vector2.zero(),
      size: Vector2.zero(),
      collisions: [
        RectangleHitbox(
          position: Vector2.all(200),
          size: Vector2.all(100),
        ),
        RectangleHitbox(
          position: Vector2.all(300),
          size: Vector2.all(100),
        ),
        CircleHitbox(
          radius: 50,
          position: Vector2.all(400),
        )
      ],
    );

    return LayoutBuilder(
      builder: (context, constraints) {
        return BonfireWidget(
          components: [collis],
          showCollisionArea: true,
          ...

This bug also occurs with GameComponent other than CollisionMapComponent.

What did you expect to happen?

I think the second and subsequent ones should have the same result as the first.

Bonfire version

3.8.5

Relevant log output

No response
RafaelBarbosatec commented 1 month ago

Hi @nyuntaka ! Thanks for this issue. In the moment I consider only the first hotbox to handle collision. I will try improve this point. Thank you!

nyuntaka commented 1 month ago

Until then, I will instead use multiple GameDecorations with one HitBox added. Thank you.

nyuntaka commented 1 month ago

I was able to confirm that it was fixed. thank you very much.