Skip to content
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

Object with id 0 can't be queried #76

Open
JTimNolan opened this issue Apr 7, 2018 · 2 comments
Open

Object with id 0 can't be queried #76

JTimNolan opened this issue Apr 7, 2018 · 2 comments

Comments

@JTimNolan
Copy link

When I launch my game, the first GameObject that gets created has id 0. Attempting to get this object from the GameWorld with gameEngine.world.queryObject({id: 0}); returns null. I'm not sure if the issue here is having an id of 0 to begin with, or if that's by design and the issue is with queryObject. I have overridden some parts of the engines, but I don't think they'd affect this. e.g. not GameWorld or GameObject. Happy to post code but just not sure what to post at this point as I'm not sure whether id:0 is something that's even meant to happen. Thanks!

@JTimNolan
Copy link
Author

Upon further review, it seems the issue is the query.id check here: https://github.com/lance-gg/lance/blob/master/src/GameWorld.js#L51 . So we either need to avoid id:0 or change to query.id != null or similar. Not sure what this check actually guards against.

@OpherV
Copy link
Member

OpherV commented Apr 7, 2018

Good catch! Thanks
I added a fix and will close the issue once this gets merged to master in the next version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants