Skip to content

Class

GridCellRaycaster3D

Generated GDScript class reference for GridPlacement.GridCellRaycaster3D.

Status
Current
Version
v6.3.0
Source updated
2026-10-29
Generated on
2026-10-29

6.3. These pages document the 6.3 release, where placeable is now entry (what changed) and PlacementOwner is deprecated (migration). Still on 6.2? Your version's guides ship inside the plugin itself, under addons/grid_placement/guides/; the 6.2 URLs on this site now redirect to this series.

Finds the GridMap cell under a screen position by casting a ray from the camera. Used by GridPositioner3D. The ray checks physics objects first, then placed objects, then the ground plane, and returns the first cell it finds, or MISS.

Source: addons/grid_placement/systems/grid_targeting/grid_positioner/3d/grid_cell_raycaster_3d.gd

Syntax

class GridCellRaycaster3D extends RefCounted

Members

NameKindSummary
cameraPropertyCamera to cast from. Must be assigned. Not exported: GridPositioner3D owns the inspector knob and passes this in when it builds the raycaster.
gridPropertyGridMap to find cells on. Must be assigned.
ground_plane_yPropertyHeight of the ground plane, in the GridMap's local space. 0 is the top of the bottom cell layer.
prefer_planePropertyWhen true the cursor resolves ground_plane_y and ignores every surface under it. A storey selector, not a fallback: every 3D demo wires a level height source, which makes the plane unreachable otherwise (measured: aiming at storey 3 over the rooms level resolved the ground at (4, 0, 2)).
cursor_collision_maskPropertyPhysics layers that stop the ray, so pointing at a wall targets the wall instead of the floor behind it. Openings without collision, such as doorways, let the ray through. Set to none to always target the ground.
ground_extent_bypassPropertyWhen true the ground tier resolves any cell the ray crosses on the ground plane, ignoring the painted-extent bound. GridPositioner3D sets this while a terrain is selected: that bound keeps object hover out of the void, but painting terrain is how ground comes to exist, so a brush has to address bare plane. Bounded to the painted box, a patch could only grow one ring at a time and a new area could never be started.
plain_groundPropertyWhen true, a ray that strikes the side of a tall column below its top resolves the ground-plane cell under the pointer instead of the struck column. CELL placement and terrain painting need the empty cell behind a ring; INFO/MOVE/DEMOLISH and socket entries keep the side target.
last_screen_posPropertyLast pick evidence for diagnostics and tests.
last_pick_cellProperty
last_volume_owner_cellPropertyOwner cell (the piece's own anchor) of the volume the last pick resolved through, or MISS when the pick came from physics or the ground. The hit cell alone cannot name a wide piece: its margins and pick shell map to whoever edge cell the ray entered.
last_ground_cellPropertyGround column under the cursor — the cell the player reads as "aimed" — independent of which piece the ray struck. A stacking preview aims this cell on the next storey, so a piece wider than the one below lands where the player points instead of being pulled onto the host's anchor.
last_march_cellProperty
last_march_from_sideProperty
last_ground_plane_cellProperty
MISSFieldSentinel returned when the ray misses the grid. The test asserts on `== MISS` rather than `== null` to make the contract explicit and to avoid Godot's null-Variant ambiguity.
cellPropertyWhere a ray first crosses the ground: the cell and the world distance along the ray, or MISS and INF.
tProperty
last_ray_originPropertyWorld-space ray of the most recent screen-to-cell call. The positioner mirrors it to the targeting state so hover identity resolves the record the ray hit, not the oldest record overlapping the cell column.
last_ray_dirProperty
last_pick_tier_3dPropertyWhich tier of cell_from_ray() decided the most recent pick: physics (exact collider), volume (grown pick boxes), ground (marched or plane crossing), plane (legacy prefer_plane path), or miss. Restated on every pick like the owner cell; miss paths keep the default. Read-only tier label for failure evidence — the commit path never branches on it.
has_last_hitPropertyWinning hit of the most recent cell_from_ray(): one ray, one hit. Socket picks (wall edge/corner/top) resolve from the SAME hit the cell came from instead of firing an independent ground-plane ray that ignores physics and volumes. Physics wins record the exact hit + face normal; volume wins the box entry + entry-face normal; ground wins the crossing with an up normal. Cleared on miss (no stale socket input).
last_hit_positionProperty
last_hit_normalProperty
last_hit_cellProperty
last_hit_colliderPropertyThe collider behind a physics-tier win (null for volume and ground wins, which have no physics body). Socket consumers reject a hit whose collider is not placement-relevant (set dressing, player) instead of resolving a socket from it.
placement_relevance_filterPropertyOptional placement-relevance predicate for physics candidates: called with each candidate CollisionObject3D, must return [bool]. An invalid callable accepts every candidate (legacy). The positioner wires this to its registry/grid check so rocks, dressing, and other unregistered bodies can never win the socket ray.
surface_height_sourcePropertySurface-height source for cursor ground hits: a Callable taking a Vector3i column cell (x, 0, z) and returning the world-space surface height as a float, or a non-finite value (such as ObjectPlacementGeometry3D.NO_GROUND) when the column has no ground. When valid, ground hits march the ray against these heights instead of the flat ground_plane_y seed plane; when invalid the legacy plane math runs exactly as before. The 3D positioner wires the live placement support surface so the cursor and commits agree on "the ground".
SURFACE_MARCH_MAX_STEPSFieldHard cap on marched columns per ground hit (failsafe; horizon-grazing rays over empty columns would otherwise march to the far plane).
IRRELEVANT_SKIP_MAXFieldHard cap on placement-irrelevant bodies skipped per physics pick (failsafe; a dense rock pile in front of the aim must not re-query unboundedly — past the cap the volume/ground tiers take over).
SURFACE_CELL_EPSILONFieldA surface caps the cell below it: crossings are mapped a hair under the surface so row-boundary tops (cube faces) resolve the item underneath instead of the empty row above, regardless of float noise.
VOLUME_CORE_EPSFieldStep past the shrunk-box entry when mapping a volume hit to its cell (then clamped back inside, so oblique rays cannot punch through a thin box into the far neighbor).
VOLUME_SHRINK_MIN_SIZEFieldVolumes thinner than this after shrinking keep the legacy entry+nudge reading: there is no core to re-enter.
GROUND_EXTENT_RINGFieldCells beyond the painted extent that an empty ground cell may still resolve to, so the next tile can start at the edge of a level.
ray_from_screen_to_cellMethod
ray_from_screen_to_cell_occludedMethod
ray_originProperty
ray_normalProperty
pickedProperty
cell_from_rayMethod
dirProperty
world_to_gridProperty
grid_originProperty
grid_normalProperty
planeProperty
solid_tProperty
solid_cellProperty
solid_hitProperty
best_volume_tProperty
best_volume_cellProperty
best_volume_entryProperty
best_volume_ownerProperty
best_volumeProperty
volumeProperty
entryProperty
tProperty
ownerProperty
groundProperty
ground_cellProperty
ground_tProperty
get_last_pick_evidenceMethod
tProperty
local_hitProperty
candidateProperty
world_hitProperty
cell_sizeProperty
posProperty
dProperty
xiProperty
ziProperty
step_xProperty
step_zProperty
t_delta_xProperty
t_delta_zProperty
frac_xProperty
frac_zProperty
t_max_xProperty
t_max_zProperty
tProperty
stepsProperty
t_nextProperty
y_enterProperty
y_exitProperty
h_worldProperty
h_localProperty
d_enterProperty
d_exitProperty
tcProperty
local_hitProperty
map_hitProperty
candidateProperty
world_hitProperty
world_tProperty
side_hitProperty
side_cellProperty
side_tProperty
planeProperty
planeProperty
ray_intersection_pointMethod
ray_ground_tracking_pointMethod
cell_from_hit_pointMethod