Scene-free 3D object placement service ( v1, ground snapping). Owns the preview ghost, validity evaluation, and placement commit for 3D sessions. Production addon code (not demo code) because valid/invalid preview feedback is core placement UX every 3D consumer needs; demos and games only wire it to their positioner/UI. Validity rules (evaluated in order, all must pass): 1. an active [ScenePlacementEntry] with a packed_scene is selected 2. no footprint cell is already occupied by a placed object 3. every footprint column has resolvable ground on the GridMap (when [member ObjectPlacementSettings3D.require_ground_cell]) 4. the surface elevation delta across the footprint stays within [member ObjectPlacementSettings3D.max_elevation_delta] ("too steep") 5. the entry's [PlacementSnapProfile3D] adjacency requirement is met (when [member PlacementSnapProfile3D.require_adjacent_snap]) Ground resolution: each footprint column is scanned top-down through the GridMap ([member ObjectPlacementSettings3D.surface_scan_max_y] .. [member ObjectPlacementSettings3D.surface_scan_min_y]); the first occupied cell's mesh AABB top is the walkable surface, so slabs, full blocks, and stacked blocks all resolve without per-item configuration. Objects rest on the HIGHEST surface under their footprint. Cell items are assumed unrotated (v1); socket-level snapping is . Visual feedback decision (see the draft guide): the ghost's meshes are TINTED via material_override (valid/invalid colors from settings) instead of spawning 2D-style indicator cubes. In 3D, per-cell indicator geometry occludes the scene and duplicates draw work; the tinted ghost communicates validity, final position, and footprint in a single visual.
Source: addons/grid_placement/systems/building/3d/object_placement_service_3d.gd
Syntax
class ObjectPlacementService3D extends RefCounted