-
-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
COLUMN_INDEX_OUT_OF_RANGE when using iter.field<T>() with .oper(flecs::Or) #1000
Comments
Yup that's expected behavior. Field types must be static during iteration, which is why OR chains with different types aren't available as fields to the iterator. What should (now- I just checked in a fix for an issue) work is the following code: auto s = ecs.system()
.with<Position>().or_()
.with<Velocity>()
.each( []( flecs::iter &iter, size_t index ) {
if( iter.world().id<Position>() == iter.id( 1 )) {
const Position *p = &iter.range().get<Position>()[index];
}
} ); Also, congrats on creating the 1000th issue 🎉 |
Thank you! This seems to work correctly for me.
Haha! |
@SanderMertens Is the Or operator C example at https://www.flecs.dev/flecs/md_docs_Queries.html#autotoc_md206 still valid? So using |
Fixed it! |
WOW, thank you, man! |
Describe the bug
When using a system query with an OR term, I seem to be unable to get the value of the field out using
iter.field<T>()
.fatal: iter.hpp: 89: assert: m_array != nullptr COLUMN_INDEX_OUT_OF_RANGE
To Reproduce
Expected behavior
iter.is_set(1)
also returns true, so I expected to be able to get the value of the Position component in this query.Additional context
I'm not sure if I'm misunderstanding the API, but looking at the example here lead me to believe that this would be possible.
The text was updated successfully, but these errors were encountered: