iterami/Docs.htm/common HTM Repos/webgl.js/webgl_pick(cursor)
- Checks if picking can currently occur and stores it in "pixelbuffer.checked":
- The core menu must be closed.
- "webgl_properties.picking" must be greater than 0.
- The "webgl_character_id" character must be alive and their level must either be -1 if "webgl_properties.paused" is true, or >=-1 otherwise.
- Uses the framebuffer and picking shader created by webgl_framebuffer_init().
- Asynchronously determines the color of the picked pixel and stores it in one of the available "webgl_pixelbuffers" objects. On the next logic frame after the color is determined, it is passed along with the "cursor" arg and other properties to webgl_pick_event(args) for handling. The object can also be retrieved via webgl_pick_entity(args).
- Picking xy is equal to "globalThis.innerWidth / 2" and "globalThis.innerHeight / 2" if "webgl_properties.pointerlock" is true, or otherwise is equal to "core_pointer.x" and "core_pointer.y".
- Entities with "picking_exclude" true cannot be picked and won't block entities behind them.
- If the picked entity has "picking_range" >0, then distance between the entity's position and the position of "webgl_characters[webgl_character_id]" is checked.
- The "cursor" arg is passed along in the "pixelbuffer" object.