SanderMertens / ecs_pong

A no-frills implementation of pong in the flecs ECS framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ECS_COLUMN index bug in Collision

erdinckaya opened this issue · comments

There is a bug in Collision System.

In that lines

    ECS_COLUMN(rows, EcsPosition2D, p_ball, 1);
    ECS_COLUMN(rows, EcsVelocity2D, v_ball, 2);

Position and Velocity components are fetched by 1 and 2, however as you can see below system definition, three components are registered.

ECS_SYSTEM(world, Collision, EcsOnSet, EcsCollision2D, Ball.EcsPosition2D, Ball.EcsVelocity2D);

In this way game crashes while fetching p_ball and gives that error

[err] assert(!size || column->size == size) flecs/src/system.c:660: column retrieved with mismatching type

I guess first component is collision component and it fetched in very first line of this system with using ecs_column.
On the whole, if we change 1, 2 to 2, 3 game works with no error.

Nice catch! Changed the column indices, thanks for reporting it.