Skip to content

Class

GridPositioner3DSpike

Generated GDScript class reference for GridPlacement.GridPositioner3DSpike.

Status
Current
Version
v6.0
Source updated
Active v6.0 guide line from Grid Placement repo
Generated on
2026-09-01

6.0.0-3D-Surface (Wave A.2 spike): GridPositioner3D camera ray-cast helper. This is a spike, not a production positioner. It validates the highest-risk piece of the 3D surface (Camera3D ray → GridMap cell) end-to-end before committing to the full Wave B/C/D plan. What it does: given a Camera3D, a GridMap, and a screen-space cursor position, returns the GridMap cell the camera is looking at (or null if the ray misses the grid). What it does NOT do: full 2D-style positioner lifecycle, mode gating, multi-camera, recenter, keyboard nav, rotation, etc. Those are Wave B/C/D work; the spike is the math, not the surface. Math: Camera3D.project_ray_origin(screen_pos) + project_ray_normal(screen_pos) gives the world-space ray. We intersect it with the y=0 (or the configured ground plane) and use GridMap.local_to_map(world_hit) to resolve the cell. GridMap is a static body in Godot 4.6; we can also use PhysicsServer3D.space_get_direct_state().intersect_ray() for a more accurate hit (catches diagonal/blocked grids). 6.0.0 host + session pattern: this spike does NOT extend PlacementNode2D / PlacementNode3D. It is a stand-alone Node3D helper; the eventual GridPositioner3D (Wave B) will wire it into the host's _input dispatch via the same pattern as GridPositioner2D (which is also a stand-alone Node2D, not a PlacementNode2D).

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

Syntax

class GridPositioner3DSpike extends Node3D

Members

NameKindSummary
cameraPropertyThe camera that the spike ray-casts through. Set this at _ready() in your test/scene; the spike does not auto-discover.
gridPropertyThe grid the spike resolves cells on. Same pattern as `camera`.
ground_plane_yPropertyThe y-coordinate (in grid-local space) of the ground plane the ray intersects. Default 0.0 = top face of the cell layer at y=0.
SPIKE_MISSFieldSentinel returned when the ray misses the grid. The test asserts on `== SPIKE_MISS` rather than `== null` to make the contract explicit and to avoid Godot's null-Variant ambiguity.
ray_from_screen_to_cellMethod
ray_intersection_pointMethod
ray_from_screen_to_cell_or_nullMethod