lance icon indicating copy to clipboard operation
lance copied to clipboard

Object with id 0 can't be queried

Open JTimNolan opened this issue 7 years ago • 2 comments

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 avatar Apr 07 '18 05:04 JTimNolan

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.

JTimNolan avatar Apr 07 '18 06:04 JTimNolan

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

OpherV avatar Apr 07 '18 19:04 OpherV