Skip to main content
Glama

find_nearest_ray_intersection_with_mesh

Read-onlyIdempotent

Cast a ray against a DynamicMeshActor's live mesh to return the nearest hit point, distance, and triangle from the latest mesh edits.

Instructions

Cast a ray against the live dynamic mesh of a DynamicMeshActor and return the nearest hit via UGeometryScriptLibrary_MeshSpatial::FindNearestRayIntersectionWithMesh. Every call builds a fresh BVH from the mesh as it is now (the plugin keeps none), so the answer always reflects the latest mesh edits. The engine normalizes ray_direction, so ray_parameter is the distance from ray_origin to the hit. hit is false when nothing is hit within max_distance. The mesh is not changed.

Returns: { actor_name, hit: bool, ray_parameter, hit_triangle_id, hit_position_x/y/z, hit_bary_coords_x/y/z } -- actor_name is the dynamic mesh component's name, not the actor label; ray_parameter is a distance along the normalized direction.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actor_nameYesLabel or name of the target DynamicMeshActor.
ray_originNo[x, y, z] origin point of the ray in mesh-local space.
max_distanceNoOptional float; max search distance (0 = unlimited).
ray_directionNo[x, y, z] direction of the ray; the engine normalizes it, so its length does not matter.
allow_unsafe_modifiedNoOptional; maps to bAllowUnsafeModifiedQueries (default false). It has no effect: the BVH is built fresh on every call, so it always matches the mesh.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.2.2
    • changedInput schema / properties / allow_unsafe_modified / description
      Previous value: -"Optional; allow querying against a mesh modified since the BVH was built without re-syncing (maps to bAllowUnsafeModifiedQueries, default false)."New value: +"Optional; maps to bAllowUnsafeModifiedQueries (default false). It has no effect: the BVH is built fresh on every call, so it always matches the mesh."
    • changedInput schema / properties / ray_direction / description
      Previous value: -"[x, y, z] direction of the ray (NOT auto-normalized; pass a unit vector for predictable distances)."New value: +"[x, y, z] direction of the ray; the engine normalizes it, so its length does not matter."
  2. First observedv1.1.0

TDQS

A4.2/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare a safe, idempotent read, and the description goes well beyond them: it discloses that a fresh BVH is rebuilt on every call (a real performance characteristic), that ray_direction is normalized making ray_parameter a true distance, that hit is false when nothing is within max_distance, and that allow_unsafe_modified has no effect. This is rich behavioral context an agent cannot get from the structured fields alone.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and the fresh-BVH behavior are front-loaded, and the return-fields sentence is compact and information-dense. It runs somewhat long with some overlap between the body and the Returns block, but no sentence is clearly wasteful.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Although there is no output schema, the description enumerates the full return object (actor_name, hit, ray_parameter, hit_triangle_id, position, barycentric coords) and clarifies actor_name is the component name, not the actor label. Together with mutation/safety context, an agent has everything needed to call and interpret the tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, the schema already documents actor_name, ray_origin, ray_direction (normalization), max_distance (0 = unlimited), and allow_unsafe_modified (no effect). The description mostly restates these; its only added value, that ray_parameter is a distance from origin to hit, is really output semantics. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource ('cast a ray against the live dynamic mesh of a DynamicMeshActor') and the concrete result ('return the nearest hit'). It also names the underlying function and implicitly distinguishes itself from siblings like find_nearest_point_on_mesh or raycast_scene, which operate on points/collision rather than a dynamic mesh BVH.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when the tool is appropriate ('the answer always reflects the latest mesh edits') but never explicitly states when to prefer it over alternatives such as raycast_scene or find_nearest_point_on_mesh. Usage is inferable from context but no exclusions or sibling routing are given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools