Find entities in view


#1

I’m thinking of adding an optional “inView” parameter to the following two API methods:

EntityScriptingInterface::findEntities(const glm::vec3& center, float radius) EntityScriptingInterface::findEntitiesInBox(const glm::vec3& corner, const glm::vec3& dimensions)

Setting inView to true would filter the results to return only entities that are currently in view.
… Unless there’s a better way to get a list of entities in view?


#2

Interesting, that’s kind of similar to how finding entities on an AC script works. There’s the view frustum for the entity viewer and then you query the octree regularly with that view to find entities. Doing that on the AC where you can’t actually see what the viewer would be seeing makes it really difficult. We most often use it by enlarging the “keyhole” - an area around, below, & behind an avatar used to make sure things around you are loaded - making it a faux- Entities.findEntities… EntityViewer code for ACs might be a good place to start.

What kinds of things are you trying to capture? IDK how the keyhole concept fits in there, whether you’d want that stuff or are really only trying to get what someone is looking at.

Cheers,
James


#3

A blind radius search does seem to unnecessarily search two hemispheres sometimes – so +1 to the prospect of having inView as a directional shotgun kind of filter.

Would also be cool if a tristate option – true for the entities “in front of you,” false for the others and default/undefined for the usual combined results.


#4

I was thinking about how to accomplish this during the creation of Pixelle but did not spend any time on it. I think it would be nice to all for a type of 3D shape that defines the search volume (kind of like our current light system)

Spotlight, Point (sphere), Half-Cone, Cube, etc etc etc.

This would reduce the amount of work on a developer using the API.

-my two cents-


#5

Well, we do have findEntitiesInBox().


#6

Have implemented it as Entities.findEntitiesInFrustum() with a corresponding Camera.frustum property to get the Camera’s view frustum. “Frustum” in Interface / entity tree rendering speak means position, orientation, and projection plus a “keyhole” centre radius. The keyhole sphere added around the origin of the standard frustum to incorporate nearby entities which may impact the view, I believe.

Implemented as part of https://github.com/highfidelity/hifi/pull/8532