Skip to content

Milestone 5: Smart Objects

Timeline: Jan 29 – Feb 2, 2026 | Status: done

Goal

Introduce smart objects (SO) — geometry with attributes. The foundation for everything that follows: editing, dimensions, hierarchy.

What Emerged

  • Composition over inheritance — SO wraps O_Scene rather than replacing it. Clean separation: SO owns identity/attributes, O_Scene owns geometry.
  • Hits_3D manager — separate from DOM-based Hits. Screen-space hit testing for corners, edges, faces with precedence ordering.
  • Front-facing detection — 2D cross product in screen coords. Faces only hittable when facing camera.
  • Face flip on rotation — selected face auto-switches to opposite when normal flips. XOR trick (index ^ 1) for paired faces.
  • Dots-only highlighting — simpler visual than line/fill. Corner=1 dot, edge=3, face=9 (corners+midpoints).

Our Work

Define what a smart object is

  • How does it differ from O_Scene? SO is primary, O_Scene is optional ref for rendering
  • Should SO wrap O_Scene or replace it? Composition — O_Scene is ref in SO
  • What attributes does an SO have?

Implement

  • Create runtime/Smart_Object.ts — extends Identifiable, has name + optional O_Scene
  • Create types/Attribute.ts — boilerplate for name/value pairs
  • Add attributes collection to Smart_Object
  • use SO to create the demo scene objects
  • Register SOs with hits manager
    • faces (with front-facing detection)
    • corners
    • edges
  • Hover highlighting (red: dot for corner, line for edge, fill for face)
  • change hover highlight to use just dots, for
    • edge: end corners, and a middle of the edge dot
    • face: all corners and all middle of edges
  • select a corner, edge, or face -- highlight dots remain visible until select another
    • respect rotation -> switch to opposite face when its normal points to camera

Test

  • Verify hit detection works

Artifacts

  • src/lib/ts/runtime/Smart_Object.ts
  • src/lib/ts/types/Attribute.ts
  • src/lib/ts/managers/Hits_3D.ts
  • src/lib/ts/signals/Events_3D.ts
  • src/lib/ts/tests/hits_3d.test.ts
  • notes/designs/Smart_Objects.md
  • notes/designs/Hits_3D.md