Make component inheritance work with returning component references in queries

Open
SanderMertens avatar @SanderMertens
C C
Created 2 months ago
Updated 23 days ago
1 comments
6,883

Describe the problem you are trying to solve. Currently queries do not return correct component references (pointers) for components matched with component inheritance. For example:

struct A {
  int x;
}:
struct B : public A {
  int y;
}

world.component<B>().is_a<A>();

world.query<A>()
  .each([](A& a) {
    // if `B` is matched, `a` might not be correct
  });

The reason this happens is because the query uses the size of a to iterate, where it should use the size of the matched component.

Describe the solution you'd like Queries should return valid component references when component inheritance is used.

No comments yet

Bounty Available

Quick Select

Custom Amount

$
Fund this bounty to attract developers and speed up resolution. Minimum amount is $0.50.

Fund Requests

No fund requests yet. Be the first to request funding.

Please sign in to request funds for this bounty.

Paid Out

No payments have been made yet. Start working on this bounty to receive your payout

Information

Open
Current status
#1537
Issue number