ray-query-3d-picking-contract

Perform deterministic 3D picking and line-of-sight ray queries with Godot Engine.

2|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/DubDev720/gdref --skill ray-query-3d-picking-contract
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ray-query-3d-picking-contract
Source: https://github.com/DubDev720/gdref/tree/main/godot-skills/godot-tertiary/ray-query-3d-picking-contract
Command: npx skills add https://github.com/DubDev720/gdref --skill ray-query-3d-picking-contract

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a reliable and deterministic way to perform 3D picking and line-of-sight checks in game development, ensuring consistent results regardless of when or how the query is executed.

Core Features & Use Cases

  • Precise Ray Casting: Utilizes Godot's Camera3D and PhysicsDirectSpaceState3D for accurate ray queries.
  • Deterministic Filtering: Ensures consistent collision masks, exclusions, and hit ordering.
  • Use Case: Implementing accurate mouse-based selection of objects in a 3D game scene or checking if a character has a clear line of sight to a target.

Quick Start

Use the ray-query-3d-picking-contract skill to perform a raycast from the center of the screen to detect the first object hit.

Frequently Asked Questions about ray-query-3d-picking-contract

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I perform deterministic 3D picking in Godot?

Deterministic 3D picking in Godot utilizes Camera3D and PhysicsDirectSpaceState3D to standardize ray origin and direction construction, ensuring consistent object selection results regardless of query execution timing.

What is the best way to set up line-of-sight ray queries in Godot?

Line-of-sight ray queries in Godot require explicit collision masks and exclusion policies combined with physics-safe querying cadences to accurately check if a character has a clear path to a target.

Why does my Godot raycast return inconsistent hits during physics frames?

Inconsistent raycast hits occur when querying cadences are not physics-safe or when collision masks and exclusions are not explicitly defined, which this Skill standardizes to prevent non-deterministic results.

Can I use Camera3D projection for mouse-based 3D object selection in Godot?

Yes, Camera3D projection can perform mouse-based 3D object selection by constructing a ray from the screen center or cursor position, querying PhysicsDirectSpaceState3D, and converting the first hit to gameplay logic.

How do I filter collision results when doing a 3D ray query in Godot?

Filtering 3D ray query results involves applying explicit collision masks and exclusion arrays to the PhysicsDirectSpaceState3D query, ensuring deterministic hit ordering and accurate hit-to-domain conversion.