Expand description
Click-to-select in the viewport.
Casts the cursor ray against every entity’s world-space bounding box and returns the nearest hit. Bounding boxes, not triangles: an editor pick has to feel instant and forgiving, and a box is both — clicking slightly off a thin object still selects it, which is what people expect from a viewport.
Everything here runs on click, never per frame, so computing a mesh’s bounds from its vertex positions on the spot is cheap enough not to need a cache. If picking ever moves to hover-highlighting, that changes and the bounds want caching against the mesh handle.
Constants§
- GIZMO_
PICK_ 🔒HALF_ EXTENT - Half-extent of the clickable box given to entities that have no mesh.
Functions§
- entity_
matrix 🔒 - World matrix for
entity, preferring the propagatedGlobalTransformso a child is picked where it is actually drawn rather than where its local transform alone would put it. - local_
bounds 🔒 - Local-space bounds for
entity: the mesh’s own extent when it has one, a small box otherwise. - pick_
entity - The nearest entity whose bounds the ray enters, if any.