GeometryScript¶
43 tools for dynamic meshes with Geometry Script: primitives, booleans, remeshing, simplifying, normals, UVs, material IDs, copying to and from static meshes, and mesh queries.
Back to the index.
add_mesh_primitive¶
Additive
Append a Box, Sphere, Cylinder or Cone to the live dynamic mesh of a DynamicMeshActor in the editor world, keeping the geometry already there: size is the box edge or the diameter and height of the round shapes, centred at location in mesh-local space. Each call adds another copy as one undo step: undo puts the mesh back as it was. Nothing is saved to an asset. An unknown actor or primitive is an error that leaves the mesh as it was; appended is true when the triangle count grew. To merge another actor's mesh use add_mesh_to_dynamic_mesh; to persist the result, copy_dynamic_mesh_to_static_mesh.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor |
primitive |
string | no | Box, Sphere, Cylinder, or Cone, default Box |
size |
number | no | Dominant dimension in cm, default 100 |
location |
array | no | Optional local [x, y, z] offset for the primitive |
dimensions |
number | no | Fallback alias for size when size is omitted (cm) |
material_id |
number | no | Optional MaterialID stamped on the appended triangles (default 0). Non-zero enables the mesh MaterialID attribute first, so a later copy_dynamic_mesh_to_static_mesh (bUseSectionMaterials=true) emits this piece as its own section/material slot. This is how one dynamic mesh becomes a multi-slot static mesh. |
Returns: { actor_name: string, primitive: string, size: number, material_id: int, triangle_count: int, triangles_added: int, vertex_count: int, appended: bool }
add_mesh_to_dynamic_mesh¶
Additive
Appends a copy of another DynamicMeshActor's live dynamic mesh to the live dynamic mesh of a target DynamicMeshActor in the editor world, keeping the geometry already there: the source vertices, shifted by append_transform, land in the target's mesh-local space, and neither actor's world transform is applied. One undo step puts the target back as it was; the source is not changed, the level is marked dirty and nothing is saved to an asset. Each call adds another copy. An empty source is a success with appended false and a note; an unknown actor, or one without a dynamic mesh, is an error. For a primitive shape use add_mesh_primitive, for a Static Mesh asset copy_static_mesh_to_dynamic_mesh, for a boolean union apply_mesh_boolean_actor_to_actor; keep the result with copy_dynamic_mesh_to_static_mesh.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or object name (case-insensitive) of the DynamicMeshActor that receives the geometry, in the editor world. |
source_actor_name |
string | yes | Label or object name (case-insensitive) of the DynamicMeshActor whose dynamic mesh is copied in; it is read, not changed. |
append_transform |
array | no | Optional [x, y, z] translation in cm added to every source vertex before the copy (default [0, 0, 0]); translation only, no rotation or scale. |
Returns: { actor_name, source_actor_name, triangles_before, triangles_after, triangles_added, vertex_count_after, appended: bool, note?: string } -- appended is false, with a note, when the source mesh has no triangles
apply_adaptive_remesh¶
Destructive
Adaptive-remesh the live dynamic mesh of a DynamicMeshActor in the editor world, found by label or name, toward max_edge_length, with the edge length scaled per vertex by a weight map and relative_density, as one undo step that restores the mesh; nothing is saved. The engine needs that weight map: without weight_map_name, or with a name the mesh has no weight layer for, it reports an error, remeshed is false and the call fails with the mesh unchanged (weight_map_resolved says whether the name was found). A missing or non-positive max_edge_length or an unknown actor is an error. remeshed is true when the triangle or vertex count changed. For uniform density use apply_uniform_remesh; to only reduce triangles, simplify_mesh. Needs Unreal Engine 5.8 or later.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor |
max_edge_length |
number | yes | Target edge length for adaptive remesh (sets TargetType=TargetEdgeLength + TargetEdgeLength). Required. |
min_edge_length |
number | no | Soft floor for adaptive edge length (default 1.0). NOTE: FGeometryScriptAdaptiveRemeshOptions has no explicit min field — this is echoed back in the result for traceability but is NOT consulted by the engine call. |
relative_density |
number | no | Density adjustment in [-2.0, 2.0] passed to FGeometryScriptAdaptiveRemeshOptions::RelativeDensity (default 0.0). |
weight_map_name |
string | no | Name of an existing vertex weight map on the mesh (resolved via UGeometryScriptLibrary_MeshQueryFunctions::GetWeightMapHandle); the engine's adaptive remesh needs one, so an omitted name or one the mesh has no layer for makes the call fail with the mesh unchanged. |
Returns: { actor_name: string, min_edge_length: number, max_edge_length: number, relative_density: number, weight_map_name: string, weight_map_resolved: bool, target_type: string, triangle_count: int, triangle_count_before: int, vertex_count: int, remeshed: bool }
apply_mesh_boolean¶
Destructive
Apply a CSG boolean (Subtract by default, Union or Intersect) between the live dynamic mesh of a DynamicMeshActor in the editor world and a temporary primitive tool: other_primitive (Sphere by default) of size cm, offset by location in mesh-local space. The target is changed in place as one undo step that restores it, nothing is saved, and each call cuts or merges again. An unknown actor, operation or primitive is an error. When the engine refuses the result (an empty one, such as subtracting from an empty mesh) the mesh is left unchanged, boolean_applied is false and the call fails. To use another actor's mesh as the tool call apply_mesh_boolean_actor_to_actor.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor |
operation |
string | no | Union, Subtract, or Intersect, default Subtract |
other_primitive |
string | no | Tool primitive shape, default Sphere |
size |
number | no | Tool primitive size in cm, default 100 |
location |
array | no | Optional tool [x, y, z] offset |
dimensions |
number | no | Fallback alias for size when size is omitted (cm) |
Returns: { actor_name: string, operation: string, other_primitive: string, triangle_count: int, triangle_count_before: int, vertex_count: int, boolean_applied: bool }
apply_mesh_boolean_actor_to_actor¶
Destructive
Apply a CSG boolean using a second DynamicMeshActor as the cutting tool. Unlike apply_mesh_boolean (which builds a transient primitive tool), the tool geometry is the live dynamic mesh of source_actor_name. The target mesh is mutated in place as one undo step that restores it; the source mesh is left untouched. NOT idempotent: re-running keeps cutting/merging the same tool against the already-modified target. When the engine refuses the result (an empty one) the target is left unchanged, boolean_applied is false and the call fails.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor (the receiver, mutated in place) |
source_actor_name |
string | yes | Label or name of the DynamicMeshActor whose live dynamic mesh is used as the boolean tool |
operation |
string | no | Union, Subtract, or Intersect, default Subtract |
use_world_transforms |
boolean | no | Optional bool, default true. When true the tool is positioned by the relative world transform (source relative to target) so the boolean respects the actors' placement; when false the tool is applied at identity (co-located). |
fill_holes |
boolean | no | Optional bool override for FGeometryScriptMeshBooleanOptions.bFillHoles (default true) |
simplify_output |
boolean | no | Optional bool override for FGeometryScriptMeshBooleanOptions.bSimplifyOutput (default true) |
Returns: { actor_name: string, source_actor_name: string, operation: string, triangle_count: int, triangle_count_before: int, vertex_count: int, boolean_applied: bool }
apply_mesh_morphology¶
Destructive
Apply an SDF-based morphology op (dilate/contract/close/open) to the live dynamic mesh of a DynamicMeshActor in the editor world, found by label or name, replacing the mesh with an SDF-based offset mesh approximation as one undo step that restores the original mesh; nothing is saved. distance is the offset in cm and must be > 0; a missing or unknown operation, a missing distance or an unknown actor is an error checked before anything changes. When the engine reports an error (a result with no triangles, as when a contract erases the whole mesh, or from an empty mesh), morphed is false, the call fails and the mesh is left as it was. Wrap into a solid instead with apply_mesh_solidify; persist the result with copy_dynamic_mesh_to_static_mesh.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor |
operation |
string | yes | Required. One of: dilate, contract, close, open. |
distance |
number | yes | Required positive float. Offset distance in cm (SDF-based). |
Returns: { actor_name, operation, distance, triangle_count, triangle_count_before, vertex_count, morphed }
apply_mesh_solidify¶
Destructive
Voxel-wrap the live dynamic mesh of a DynamicMeshActor in the editor world, found by label or name: the mesh is replaced by a voxelised-and-meshed approximation on a grid of 64 cells along its longest side, as one undo step that restores the original mesh; nothing is saved. An unknown actor is an error. When the engine reports an error (a result with no triangles, as from an empty mesh), solidified is false, the call fails and the mesh is left as it was. For an offset surface use apply_mesh_morphology; to only fix self-intersections, repair_mesh_self_intersections; persist the result with copy_dynamic_mesh_to_static_mesh.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor |
winding_threshold |
number | no | Optional [0..1], default 0.5. Space with generalised winding number above this is considered inside. |
extend_bounds |
number | no | Optional positive float, default 1.0. Bounds extension applied to the default input-mesh-based bounds. |
surface_search_steps |
integer | no | Optional int >= 1, default 3. Marching-cubes vertex search steps. |
thicken_shells |
boolean | no | Optional bool, default false. Thicken open shells into closed solids (expensive on large meshes). |
shell_thickness |
number | no | Optional positive float, default 1.0. Offset distance for shell thickening. |
Returns: { actor_name, triangle_count, triangle_count_before, vertex_count, solidified }
apply_uniform_remesh¶
Destructive
Remesh the live dynamic mesh of a DynamicMeshActor in the editor world into evenly sized triangles, aiming at target_edge_length (cm) or target_tri_count: exactly one is required, else an error. The mesh changes in place as one undo step that restores it, and the actor's package is marked dirty, not saved. smoothing_type picks uniform, UV-preserving or mixed smoothing; an unknown value is an error. The reply echoes the settings the engine was given. remeshed is true when the triangle or vertex count changed. For variable density use apply_adaptive_remesh; to only reduce triangles, simplify_mesh.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor |
target_edge_length |
number | no | Target uniform edge length in mesh units (sets TargetType=TargetEdgeLength). Mutually exclusive with target_tri_count; at least one is required. |
target_tri_count |
integer | no | Approximate target triangle count (sets TargetType=TriangleCount). Mutually exclusive with target_edge_length. |
preserve_sharp_edges |
boolean | no | Approximate 'preserve sharp edges' by enabling bPreventNormalFlips on the shared RemeshOptions (default true; UE's FGeometryScriptUniformRemeshOptions has no explicit preserve-sharp flag, so the closest equivalent is the shared RemeshOptions.bPreventNormalFlips). |
smoothing_type |
string | no | One of 'uniform' | 'uv_preserving' | 'mixed' (default 'mixed'), uvpreserving accepted too; maps to EGeometryScriptRemeshSmoothingType on the shared RemeshOptions. |
auto_compact |
boolean | no | Auto-compact the index space after remesh on the shared RemeshOptions (default true). |
Returns: { actor_name: string, target_edge_length: number, target_tri_count: int, preserve_sharp_edges: bool, smoothing_type: string, auto_compact: bool, target_type: string, triangle_count: int, triangle_count_before: int, vertex_count: int, remeshed: bool }
build_mesh_bvh¶
Read-only
Build a BVH (bounding volume hierarchy) for the live dynamic mesh of a DynamicMeshActor in the editor world with BuildBVHForMesh, and read it back with IsBVHValidForMesh. The plugin keeps no BVH between calls: this one is dropped on return, and the spatial-query tools (find_nearest_point_on_mesh, find_nearest_ray_intersection_with_mesh, is_point_inside_mesh) build their own on every call, so they never need this first. It checks that a BVH can be built for the mesh as it is now, which is also the answer to whether a valid BVH exists for it: built (and its alias bvh_rebuilt) is true when the engine reported no error and the BVH reads back as valid (bvh_valid); the call fails otherwise. The mesh is not changed.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor. |
b_only_if_invalid |
boolean | no | Optional bool, default true; it has no effect, since no earlier BVH is kept and every call builds a new one. |
Returns: { actor_name, built: bool, bvh_rebuilt: bool, b_only_if_invalid: bool, bvh_valid: bool, vertex_count, triangle_count } -- bvh_rebuilt is the same flag as built; actor_name is the dynamic mesh component's name, not the actor label; b_only_if_invalid echoes the request; the counts are those of the mesh the BVH was built for.
clear_dynamic_mesh¶
Destructive Idempotent
Empty a DynamicMeshActor's live UDynamicMesh in place (keep the actor, drop the geometry). One undo step restores the geometry; an already empty mesh adds no undo step.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the DynamicMeshActor to clear (required). |
Returns: { actor_name: string, triangle_count_before: int, triangle_count_after: int, vertex_count_before: int, vertex_count_after: int, cleared: bool }
compact_mesh¶
Destructive Idempotent
Compact a DynamicMeshActor's live dynamic mesh in the editor world (actor found by label or object name): renumber its vertex, triangle and edge IDs into dense ranges, dropping the free ID slots that deletions leave. Geometry and the vertex and triangle counts stay the same, but IDs move, so vertex or triangle IDs read before (select_mesh_triangles, get_mesh_components_detail) are stale afterwards. Idempotent: compacted is true when any ID moved, and one undo step restores the old IDs; an already compact mesh is a success with compacted=false and adds no undo step. Nothing is saved; an unknown actor is an error. Run it after remove_mesh_triangles or remove_unused_vertices, and before the xatlas method of unwrap_mesh_uvs.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or object name of the DynamicMeshActor in the editor world (case-insensitive). |
Returns: { actor_name: string, triangle_count: int, vertex_count: int, compacted: bool }
copy_dynamic_mesh_to_static_mesh¶
Destructive Idempotent
Write the live dynamic mesh of a DynamicMeshActor INTO an EXISTING /Game UStaticMesh asset's LOD via UGeometryScriptLibrary_StaticMeshFunctions::CopyMeshToStaticMesh (7-arg V2, bUseSectionMaterials=true; engine-default options). Editor-only (the engine function is WITH_EDITOR-gated and touches GEditor + FlushRenderingCommands). Idempotent: overwrites the target LOD in place, no duplication. HONEST GATES: the target asset must already exist (create it first, e.g. duplicate_asset of /Engine/BasicShapes/Cube into /Game) and must NOT live under /Engine/ (the engine refuses to modify built-in engine assets). A lod_index outside 0 to 7 (a static mesh has at most 8 LODs) is an error checked before anything changes; one past the asset's last LOD adds the LODs in between, which the engine sets up to be reduced from an earlier LOD.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the source DynamicMeshActor. |
target_static_mesh_path |
string | yes | Content path of an EXISTING /Game UStaticMesh to overwrite. |
lod_index |
integer | no | Optional target LOD index, 0 to 7 (default 0); a negative index or one of 8 or more is refused. |
materials |
array | no | Optional ordered list of UMaterialInterface content paths, one per MaterialID (index 0 = MaterialID 0). Supplying it flips bReplaceMaterials on, so the target asset gets exactly these material slots. WITHOUT this the asset keeps its existing slots and a multi-MaterialID mesh collapses into whatever slots already existed — this is the parameter that makes per-triangle MaterialIDs visible on the saved asset. |
material_slot_names |
array | no | Optional slot names matching materials 1:1 (default: the engine names them). Ignored when materials is absent. |
Returns: { actor_name, target_static_mesh_path, lod_index, outcome_success: bool, source_triangle_count, material_count: int, replaced_materials: bool, wrote: bool }. NOTE: this marks the target package dirty (transaction) but does NOT save to disk — persistence requires a separate save (e.g. via save_asset).
copy_mesh_uv_channel¶
Additive
Copy UV data from one UV channel to another on the same mesh. A dest_channel the mesh does not have yet is added first (the channel count only grows, and channels added in between have no UVs set); a source_channel the mesh does not have, or a dest_channel of 8 or more, is an error checked before anything changes. copied is false, and the call fails, when the engine reports an error; the same channel for both is a no-op that succeeds with copied false and a note. One undo step restores the channels, a failed copy leaves the mesh as it was, and nothing is saved.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | DynamicMeshActor name (required) |
source_channel |
number | yes | Source UV channel index (required) |
dest_channel |
number | yes | Destination UV channel index, 0 to 7 (required, added to the mesh when it does not have it yet) |
Returns: { actor_name: string, source_channel: int, dest_channel: int, copied: bool, num_uv_channels_after: int, note?: string } -- actor_name is the dynamic mesh component's name, not the actor label; copied is false when source_channel equals dest_channel, and note says so or that the mesh grew new channels to reach dest_channel.
copy_static_mesh_to_dynamic_mesh¶
Destructive Idempotent
Copy the geometry of a UStaticMesh asset INTO the live dynamic mesh of a DynamicMeshActor via UGeometryScriptLibrary_StaticMeshFunctions::CopyMeshFromStaticMesh (engine-default options: build settings applied, tangents on). Destructive replace of the actor's current mesh. Idempotent-ish: re-running re-extracts the same source geometry. It reads LOD lod_index (default 0) from its source model, or from its render data when that LOD has no source geometry, as a reduced one (read_render_data); a LOD the mesh does not have, or a mesh with no geometry to read, is an error checked before the actor is touched. One undo step restores the previous mesh, a failed copy leaves it as it was, and nothing is saved. Write back to an asset: copy_dynamic_mesh_to_static_mesh; query an asset without a copy: get_static_mesh_geometry_stats.
| Parameter | Type | Required | Description |
|---|---|---|---|
source_static_mesh_path |
string | yes | Content path of the source UStaticMesh (e.g. "/Engine/BasicShapes/Cube"). |
actor_name |
string | yes | Label or name of the target DynamicMeshActor whose GetDynamicMesh() receives the geometry. |
lod_index |
integer | no | Optional source LOD to read (default 0), from 0 to the mesh's last LOD, echoed as requested_lod_index; a negative one or one the mesh does not have is an error. |
Returns: { source_static_mesh_path, actor_name, lod_index, requested_lod_index, read_hi_res_source, read_render_data, outcome_success: bool, triangle_count, vertex_count, copied: bool }
find_nearest_point_on_mesh¶
Read-only
Find the nearest point on the live dynamic mesh of a DynamicMeshActor to a 3D query point via UGeometryScriptLibrary_MeshSpatial::FindNearestPointOnMesh. Every call builds a fresh BVH from the mesh as it is now (the plugin keeps none), then queries it, so the answer always reflects the latest mesh edits. found is false when no triangle lies within max_distance, or the mesh is empty. The mesh is not changed.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor. |
query_point |
array | yes | [x, y, z] query point in the mesh's local space. |
max_distance |
number | no | Optional float; max search distance (0 = unlimited). |
allow_unsafe_modified |
boolean | no | Optional; maps to bAllowUnsafeModifiedQueries (default false). It has no effect: the BVH is built fresh on every call, so it always matches the mesh. |
Returns: { actor_name, found: bool, valid: bool, triangle_id, position_x/y/z, bary_coords_x/y/z } -- actor_name is the dynamic mesh component's name, not the actor label.
find_nearest_ray_intersection_with_mesh¶
Read-only
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. A ray_direction that cannot be normalized (all zeros, a non-finite value, or not an array of three numbers) is refused before anything else runs. hit is false when nothing is hit within max_distance. The mesh is not changed.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor. |
ray_origin |
array | yes | [x, y, z] origin point of the ray in mesh-local space. |
ray_direction |
array | yes | [x, y, z] direction of the ray; the engine normalizes it, so its length does not matter, but a zero or non-finite direction is an error. |
max_distance |
number | no | Optional float; max search distance (0 = unlimited). |
allow_unsafe_modified |
boolean | no | Optional; maps to bAllowUnsafeModifiedQueries (default false). It has no effect: the BVH is built fresh on every call, so it always matches the mesh. |
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.
get_dynamic_mesh_info¶
Read-only
Read geometry stats off a DynamicMeshActor's live dynamic mesh in the editor world: triangle and vertex counts, whether it is closed, empty or dense (no triangle ID gaps), whether it carries an attribute set, its connected components, open border edges (0 when closed) and extended polygroup layers, and the UV island count of each UV channel. Read-only.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor |
uv_channel |
number | no | Optional UV channel index: report the UV islands of that channel only (default every channel). A negative channel is an error; a channel the mesh does not have is reported, not refused, with is_valid_uv_channel=false. |
Returns: { actor_name: string, actor_internal_name: string, component_name: string, triangle_count: int, vertex_count: int, is_closed: bool, is_empty: bool, is_dense: bool, has_attribute_set: bool, num_connected_components: int, num_open_border_edges: int, num_polygroup_layers: int, uv_channel_count: int, uv_channels: [{ uv_channel: int, num_uv_islands: int, is_valid_uv_channel: bool }] }
get_mesh_components_detail¶
Read-only
Enumerate the connected components (physical pieces) of a DynamicMeshActor's live dynamic mesh via UE::Geometry::FMeshConnectedComponents, reporting for EACH island its triangle count, its local-space bounding box, its triangle_id range and which MaterialIDs it carries. Read-only (unlike the engine's SplitMeshByComponents, which consumes the mesh). This is the map of a mesh in ONE call, and the tool to reach for BEFORE painting anything: get_mesh_material_ids says how many triangles carry each material, and this says what those triangles physically ARE. HONEST GATE: it names nothing — it gives you sizes and positions, and which island is which part is still a human call; what it prevents is deriving that from a triangle-count assumption.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor. |
max_components |
integer | no | Cap on how many islands to return (default 64). components_truncated says whether the cap cut the list; component_count is always the real total. |
include_triangle_ids |
boolean | no | Also return each island's full triangle ID list (default false; use the reported id_min/id_max range instead unless the island is non-contiguous). |
Returns: { actor_name, component_count: int, components_truncated: bool, components: [ { index, triangle_count, id_min, id_max, id_contiguous: bool, material_ids: [int], bounds: { min_x, min_y, min_z, max_x, max_y, max_z, center_x, center_y, center_z, size_x, size_y, size_z }, triangle_ids: [int] } ] }
get_mesh_material_ids¶
Read-only
Read the per-triangle MaterialID distribution of a DynamicMeshActor's live dynamic mesh via UGeometryScriptLibrary_MeshMaterialFunctions::GetMaxMaterialID + GetAllTriangleMaterialIDs. Read-only. This is the ORACLE for every MaterialID write: it returns a per-ID triangle histogram, so "did the paint actually land?" is answerable with a read instead of trusting a success flag. IMPORTANT: has_material_ids=false means the mesh has no MaterialID attribute at all, which is exactly the state in which writes are silently dropped by the engine.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor. |
Returns: { actor_name, has_material_ids: bool, max_material_id: int, triangle_count: int, distinct_material_ids: int, histogram: [ { material_id: int, triangle_count: int } ] }
get_static_mesh_geometry_stats¶
Read-only
Measure one LOD of a static mesh asset, read-only, in mesh-local space (cm, build settings and scale applied): surface area, signed volume and center of mass (meaningful only when is_closed; reversed winding makes the volume negative), watertightness, bounding box, triangle and vertex counts with ID-space gaps, connected components, open border loops (open_border_spans and ambiguous_topology flag what the engine cannot close), UV channel count, and the UV-space area of uv_channel (the 0-1 square filled once sums to 1.0). A source model shares vertices across UV and normal seams, so vertex_count is usually below the render counts of get_static_mesh_info; a LOD without source geometry is read from render data (read_render_data). A missing LOD, a path that is not a static mesh, or a mesh without geometry is an error.
| Parameter | Type | Required | Description |
|---|---|---|---|
static_mesh_path |
string | yes | Content path to the UStaticMesh asset (e.g. "/Engine/BasicShapes/Cube"; the object path form also works). |
lod_index |
integer | no | LOD to read (default 0), from 0 to the mesh's last LOD, echoed as requested_lod_index; a LOD the mesh does not have is an error and nothing is read. |
uv_channel |
number | no | Optional UV channel whose UV area is measured (default 0). A negative one is an error; a channel the mesh lacks gives is_valid_uv_channel false and uv_area 0. |
Returns: { static_mesh_path, lod_index, requested_lod_index, read_hi_res_source, read_render_data, surface_area, volume, center_of_mass_x, center_of_mass_y, center_of_mass_z, is_closed, min_x, min_y, min_z, max_x, max_y, max_z, extent_x, extent_y, extent_z, center_x, center_y, center_z, triangle_count, triangle_id_count, has_triangle_id_gaps, vertex_count, vertex_id_count, has_vertex_id_gaps, connected_components, open_border_loops, open_border_spans, ambiguous_topology, uv_channel_count, uv_channel, uv_area, is_valid_uv_channel }
is_point_inside_mesh¶
Read-only
Tests whether a point lies inside the live dynamic mesh of a DynamicMeshActor in the editor world, with the engine's fast winding number (IsPointInsideMesh), which also gives a sensible answer for meshes with small holes. Every call builds a fresh BVH and winding tree from the mesh as it is now, so the answer reflects the latest edits; nothing is changed or saved. An unknown actor is an error, and so is a query_point that is missing or not exactly three numbers (a malformed point is refused, never read as the origin). Use it for inside/outside tests; for the closest surface point use find_nearest_point_on_mesh, for a ray hit find_nearest_ray_intersection_with_mesh; build_mesh_bvh is never needed first. The point is in mesh-local space: subtract the actor's location (and undo its rotation and scale) to test a world position.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or object name (case-insensitive) of the DynamicMeshActor in the editor world. |
query_point |
array | yes | [x, y, z] point in the mesh's local space, in cm (e.g. [0, 0, 50]): exactly three JSON numbers, anything else is an error. |
winding_threshold |
number | no | Optional float, default 0.5: the winding number above which the point counts as inside; higher values shrink the inside region, lower ones grow it. |
max_distance |
number | no | Optional float; it has no effect on this query, whose winding-number test uses no search distance. |
allow_unsafe_modified |
boolean | no | Optional; maps to bAllowUnsafeModifiedQueries (default false). It has no effect: the BVH is built fresh on every call, so it always matches the mesh. |
Returns: { actor_name, is_inside: bool, containment_outcome: string } -- actor_name is the dynamic mesh component's name, not the actor label.
recompute_mesh_normals¶
Destructive Idempotent
Recompute the normals of the live dynamic mesh of a DynamicMeshActor in the editor world, overwriting the values of its existing normal overlay while keeping its hard-edge splits; a mesh without normals first gets per-vertex normals. Face contributions are weighted by area and by corner angle (both on by default; both off gives a plain average). Idempotent, nothing saved: one undo step restores the previous normals, and a recompute that changes nothing adds no undo step. An empty mesh is an error, and recomputed is false (the call fails, leaving the mesh as it was) when the engine reports an error. Use it when shading looks wrong after geometry edits; copy_dynamic_mesh_to_static_mesh persists the result.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor |
angle_weighted |
boolean | no | Weight contributing face normals by corner angle, default true |
area_weighted |
boolean | no | Weight contributing face normals by face area, default true |
Returns: { actor_name: string, angle_weighted: bool, area_weighted: bool, triangle_count: int, vertex_count: int, recomputed: bool }
recompute_mesh_uvs¶
Destructive
Re-flatten the UVs of one channel on a DynamicMeshActor's live dynamic mesh in the editor world island by island: each existing UV island (or polygroup) keeps its triangles and gets new UVs from the chosen flatten method, as one undo step; the level is marked dirty and nothing is saved. Use it to fix stretched islands while keeping the seams, then repack_mesh_uvs to lay them out in the 0-1 square; unwrap_mesh_uvs cuts new seams over the whole mesh and set_mesh_uvs_from_projection projects instead. An unknown actor, a channel the mesh lacks, an empty mesh, or an unknown island_source or method is an error before anything changes; when the engine refuses (polygroups on a mesh without polygroups) recomputed is false, the call fails and the UVs stay as they were.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or object name of the target DynamicMeshActor in the editor world, e.g. 'DynamicMeshActor_0'. |
uv_channel |
number | no | 0-based UV channel index (default 0); get_dynamic_mesh_info shows the channels the mesh has. |
island_source |
string | no | What one island is: "uv_islands" (the channel's existing islands, default) or "polygroups" (one island per polygroup); case-insensitive, any other value is an error. |
method |
string | no | Flatten method: "spectral_conformal" (default), "conformal" or "exp_map"; case-insensitive. |
Returns: { actor_name, uv_channel, island_source, method, recomputed }
remap_material_ids¶
Destructive
Renumber MaterialIDs on a DynamicMeshActor's live dynamic mesh. Two modes: pass from_material_id + to_material_id to merge one ID into another (UGeometryScriptLibrary_MeshMaterialFunctions::RemapMaterialIDs), or pass compact=true with the material list to close gaps left by deleted/merged IDs (CompactMaterialIDs) and get back the compacted list to hand to copy_dynamic_mesh_to_static_mesh. Gaps matter: MaterialIDs index into that list positionally, so an unused ID in the middle costs a wasted material slot on the baked asset. The materials list may be shorter than the IDs in use (or absent): the missing entries count as no material. When no triangle carries from_material_id, or from and to are the same ID, the mesh is left unchanged and the call succeeds with applied false, triangles_remapped 0 and a note. Otherwise applied is measured (remap: the triangles that carried from_material_id no longer do; compact: the engine reported no error) and the call fails when it is false, leaving the MaterialIDs as they were. One undo step restores the previous MaterialIDs.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor. |
compact |
boolean | no | Compact mode: renumber IDs to be contiguous from 0 (default false). |
from_material_id |
integer | no | Remap mode: the MaterialID to replace. Required unless compact is true. |
to_material_id |
integer | no | Remap mode: the MaterialID to replace it with. Required unless compact is true. |
materials |
array | no | Compact mode: ordered UMaterialInterface content paths, one per current MaterialID. The compacted list is returned in compacted_materials, in the new ID order. |
remove_duplicate_materials |
boolean | no | Compact mode: also merge IDs that point at the SAME material asset (default false). |
Returns: { actor_name, mode: string, from_material_id: int, to_material_id: int, triangles_remapped?: int, max_material_id_after: int, distinct_material_ids_after: int, compacted_materials: [string], applied: bool, note?: string }
remove_dynamic_mesh_actor¶
Destructive
Destroy a DynamicMeshActor in the editor world, found by label or object name, inside an undoable transaction. Returns the label, internal name and triangle_count_before of the destroyed actor; fails if the name matches no DynamicMeshActor. Create one with spawn_actor.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or object name (case-insensitive) of the DynamicMeshActor to destroy. |
Returns: { actor_name: string, actor_internal_name: string, destroyed: bool, triangle_count_before: int, note?: string }
remove_mesh_triangles¶
Destructive
Delete the listed triangle IDs (triangle_ids, or a single triangle_id) from a DynamicMeshActor's live dynamic mesh in the editor world; IDs that do not exist are skipped, so compare num_deleted with requested_count (a missing ID is not an error: deleted just comes back false). One undo step restores the triangles, and a call that deletes none adds no undo step; reply actor_name is the component name, not the actor label.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or object name (case-insensitive) of the target DynamicMeshActor in the editor world. |
triangle_ids |
array | no | Non-empty array of non-negative integer triangle IDs, e.g. [0, 5, 12]; any negative or non-numeric entry fails the call. Required unless triangle_id is given. |
triangle_id |
integer | no | Optional single non-negative triangle ID, read as triangle_ids [triangle_id] when triangle_ids is absent. |
Returns: { actor_name, num_deleted, requested_count, deleted: bool, triangle_id?: int, triangle_count, previous_triangle_count } -- deleted is num_deleted > 0; triangle_id echoes the single ID when it was given.
remove_unused_vertices¶
Destructive
Deletes the orphan vertices (those no triangle uses) of a DynamicMeshActor's live dynamic mesh in the editor world and refreshes its render data; triangles and their shape are untouched. Remaining vertex IDs are not renumbered: run compact_mesh afterwards for dense IDs. A mesh without orphan vertices is a success with removed false and adds no undo step; otherwise one undo step restores the mesh. The level is marked dirty, nothing is saved to an asset; an unknown actor or one without a dynamic mesh is an error. Typical after remove_mesh_triangles or apply_mesh_boolean; open seams are closed by weld_mesh_edges, overlaps by repair_mesh_self_intersections, and get_dynamic_mesh_info reads the counts.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or object name (case-insensitive) of the target DynamicMeshActor in the editor world; create one with spawn_actor. |
Returns: { actor_name: string, triangle_count: int, vertex_count: int, vertex_count_before: int, vertices_removed: int, removed: bool }
repack_mesh_uvs¶
Destructive
Pack existing UV islands on a UV channel into standard UV space. A channel the mesh does not have, or an empty mesh, is an error checked before anything changes. A channel with no UVs set has no islands to pack: the call succeeds with repacked false and a note, leaving the mesh unchanged. Otherwise repacked is false, and the call fails, leaving the UVs as they were, when the engine reports an error. One undo step restores the previous UVs, nothing saved.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | DynamicMeshActor name (required) |
uv_channel |
number | no | UV channel index (default 0) |
target_image_width |
number | no | target image width in pixels (default 512) |
optimize_island_rotation |
boolean | no | whether to optimize island rotation (default true) |
Returns: { actor_name, uv_channel, target_image_width, optimize_island_rotation, num_uv_islands, repacked, note? }
repair_mesh_self_intersections¶
Destructive
Boolean-union a DynamicMeshActor's dynamic mesh with itself to repair self-intersections, remove internal/floating geometry and resolve non-manifold overlaps (UGeometryScriptLibrary_MeshBooleanFunctions::ApplyMeshSelfUnion). Convergent: the first pass mutates the mesh, but a second pass on the already-cleaned mesh is a no-op (repaired reports false). One undo step restores the mesh, and a pass that changes nothing adds no undo step. NOTE: the engine impl ignores its internal success flag and always returns the target mesh, so success is measured by comparing the triangle count, not by the return value.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor (mutated in place) |
fill_holes |
boolean | no | Optional bool override for FGeometryScriptMeshSelfUnionOptions.bFillHoles (default true) |
trim_flaps |
boolean | no | Optional bool override for FGeometryScriptMeshSelfUnionOptions.bTrimFlaps (default true) |
simplify_output |
boolean | no | Optional bool override for FGeometryScriptMeshSelfUnionOptions.bSimplifyOutput (default true) |
winding_threshold |
number | no | Optional [0..1] float override for FGeometryScriptMeshSelfUnionOptions.WindingThreshold (default 0.5). Space with generalised winding number above this is considered inside. |
Returns: { actor_name: string, triangle_count: int, triangle_count_before: int, vertex_count: int, is_closed: bool, repaired: bool }
rotate_mesh_uvs¶
Destructive
Rotate all UVs of one channel on a DynamicMeshActor's live dynamic mesh in the editor world by an angle in degrees around a UV-space pivot; 0 degrees changes nothing (rotated false) and adds no undo step. One undo step restores the UVs; reply actor_name is the component name, not the actor label.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or object name (case-insensitive) of the target DynamicMeshActor in the editor world. |
uv_channel |
number | yes | 0-based UV channel index; a channel the mesh does not have fails the call. |
rotation_angle_deg |
number | yes | Rotation angle in degrees; 0 leaves the UVs untouched. |
rotation_origin_u |
number | no | U coordinate of the rotation pivot (default 0). |
rotation_origin_v |
number | no | V coordinate of the rotation pivot (default 0). |
Returns: { actor_name, uv_channel, rotation_angle_deg, rotation_origin: {u, v}, rotated: bool }
scale_mesh_uvs¶
Destructive
Scale all UVs of one channel on a DynamicMeshActor's live dynamic mesh in the editor world by separate U and V factors around the scale origin, as one undo step that restores the UVs; nothing is saved. The factors are checked as the floats the engine uses: a zero factor, or a scale shorter than 0.0001, which the engine would silently replace with 1, 1, is an error and nothing changes. A scale of 1, 1 changes nothing: scaled is false with a note, and no undo step is added. A channel the mesh lacks or an unknown actor is an error. Reply actor_name is the component name, not the actor label. Offset UVs: translate_mesh_uvs; rotate them: rotate_mesh_uvs; copy a channel: copy_mesh_uv_channel.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or object name (case-insensitive) of the target DynamicMeshActor in the editor world. |
uv_channel |
number | yes | 0-based UV channel index; a channel the mesh does not have fails the call. |
scale_u |
number | yes | Scale factor along U; must be non-zero (1 keeps U unchanged). |
scale_v |
number | yes | Scale factor along V; must be non-zero (1 keeps V unchanged). |
scale_origin_u |
number | no | U coordinate of the point the scaling is centred on (default 0). |
scale_origin_v |
number | no | V coordinate of the point the scaling is centred on (default 0). |
Returns: { actor_name: string, uv_channel: int, scale_u: number, scale_v: number, scale_origin: { u, v }, scaled: bool, note: string? }
select_mesh_triangles¶
Read-only
Resolve a region of a DynamicMeshActor's live dynamic mesh into a triangle selection and report it, with its count and local-space bounding box, without modifying anything (no undo step, nothing dirtied). Read-only companion of set_mesh_material_id scope='region' (and of the region of set_mesh_uvs_from_projection): same region parameters, same resolver, so a region previewed here paints exactly those triangles there. The bounds are what turn a bisection answer ("the piece is somewhere in X>0") into numbers: centre and size. Use it to avoid the failure mode where a mis-specified box selects 0 triangles and the paint call still returns success. Coordinates are LOCAL to the dynamic mesh, not world.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor. |
region |
string | no | 'all' (default) | 'box' | 'sphere' | 'plane' | 'normal_angle' | 'material_id' | 'polygroup' | 'connected_component' (one physical PIECE, by the island index that get_mesh_components_detail reports). |
center |
array | no | Local [x,y,z] centre. Used by box/sphere, and as the plane origin. |
extent |
array | no | Local [x,y,z] HALF-size in cm. Required by region='box'. |
radius |
number | no | Radius in cm. Required by region='sphere'. |
normal |
array | no | [x,y,z] direction. Plane normal for region='plane', facing direction for 'normal_angle'. Default [0,0,1]. |
max_angle_deg |
number | no | Max angle from normal in degrees for region='normal_angle' (default 15). |
source_material_id |
integer | no | MaterialID to select when region='material_id'. |
polygroup_id |
integer | no | Polygroup to select when region='polygroup'. |
polygroup_layer |
integer | no | Optional extended polygroup layer index for region='polygroup'. |
component_index |
integer | no | Island index when region='connected_component'. Get it from get_mesh_components_detail, which reports each piece's size and bounding box. |
min_triangle_points |
integer | no | How many of a triangle's 3 points must be inside for it to count, 1-3 (default 3 = fully contained). |
invert |
boolean | no | Invert the spatial selection (default false). |
include_triangle_ids |
boolean | no | Also return the resolved triangle IDs (default false; they can be thousands). The returned array is what set_mesh_material_id scope='triangles' consumes. |
max_triangle_ids |
integer | no | Cap on how many IDs to return when include_triangle_ids is on (default 1000). When the cap truncates, triangle_ids_truncated is true — the count in triangles_selected is still the real one. |
Returns: { actor_name, region, triangles_selected: int, mesh_triangle_count: int, is_empty: bool, bounds: { min_x, min_y, min_z, max_x, max_y, max_z, center_x, center_y, center_z, size_x, size_y, size_z }, triangle_ids: [int], triangle_ids_truncated: bool } -- bounds are all 0 when the selection is empty.
set_dynamic_mesh_material¶
Destructive Idempotent
Sets the material of one slot on a DynamicMeshActor's DynamicMeshComponent in the editor world, in one undo step, and refreshes its render state; the level is marked dirty, not saved. applied is the slot read back; the call fails when the slot does not hold the material. Setting the material a slot already has succeeds again (applied true). A missing actor, component or material, or a slot_index outside the component's slots, is an error and nothing changes. Which triangles use a slot is their MaterialID: paint it with set_mesh_material_id and read it with get_mesh_material_ids. For static mesh actors use set_actor_material; get_available_materials lists material paths.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or object name (case-insensitive) of the DynamicMeshActor in the editor world (required). |
material_path |
string | yes | Object path of a material or material instance (e.g. "/Engine/EngineMaterials/DefaultMaterial.DefaultMaterial"; a path without the .Name suffix also loads), as get_available_materials returns it (required). |
slot_index |
number | no | 0-based material slot, less than the component's slot count (slot 0 is always accepted); default 0. |
Returns: { actor_name: string, material_path: string, material_name: string, slot_index: int, applied: bool, note?: string }
set_mesh_material_id¶
Destructive Idempotent
Stamp a MaterialID onto triangles of a DynamicMeshActor's live dynamic mesh. scope='all' repaints every triangle (UGeometryScriptLibrary_MeshMaterialFunctions::ClearMaterialIDs); scope='triangles' repaints the listed triangle IDs (SetMaterialIDOnTriangles); scope='region' repaints every triangle inside a region resolved like select_mesh_triangles (SetMaterialIDForMeshSelection) -- a box, sphere, plane, normal angle, an existing MaterialID, one polygroup (region='polygroup' with polygroup_id: appended primitives are each their own polygroup, so this is usually the cheapest way to paint a part) or one connected component, the way to address pieces a boolean has fused. Calls EnableMaterialIDs first, because on a mesh without that attribute the engine drops the write. An ID in triangle_ids that is not a triangle, an empty mesh, or a polygroup layer the mesh does not have, is an error checked before anything is painted. A region that selects no triangle succeeds with applied false, triangles_selected 0 and a note, leaving the mesh unchanged. The targeted triangles are read back: applied is true when all of them carry material_id, and the call fails otherwise, leaving the MaterialIDs as they were. One undo step restores the previous MaterialIDs.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor. |
material_id |
integer | yes | MaterialID to write (>= 0). Index into the material list later passed to copy_dynamic_mesh_to_static_mesh. |
scope |
string | no | 'all' | 'triangles' | 'region'. Default 'region' when region is given, else 'all'. |
triangle_ids |
array | no | Required when scope='triangles': array of triangle IDs to repaint (e.g. from select_mesh_triangles). |
region |
string | no | scope='region' only: 'all' (default) | 'box' | 'sphere' | 'plane' | 'normal_angle' | 'material_id' | 'polygroup' | 'connected_component' (one physical PIECE, by the island index that get_mesh_components_detail reports). Coordinates are LOCAL to the dynamic mesh, not world; preview a region with select_mesh_triangles. |
center |
array | no | Region parameter: local [x,y,z] centre. Used by box/sphere, and as the plane origin. |
extent |
array | no | Region parameter: local [x,y,z] HALF-size in cm. Required by region='box'. |
radius |
number | no | Region parameter: radius in cm. Required by region='sphere'. |
normal |
array | no | Region parameter: [x,y,z] direction. Plane normal for region='plane', facing direction for 'normal_angle'. Default [0,0,1]. |
max_angle_deg |
number | no | Region parameter: max angle from normal in degrees for region='normal_angle' (default 15). |
source_material_id |
integer | no | Region parameter: the MaterialID to SELECT when region='material_id'. Separate from material_id, which is the one being written, so 'repaint 1 as 2' is expressible. |
polygroup_id |
integer | no | Region parameter: polygroup to select when region='polygroup'. |
polygroup_layer |
integer | no | Region parameter: optional extended polygroup layer index for region='polygroup' (default the mesh's default polygroup layer). A layer the mesh does not have is an error. |
component_index |
integer | no | Region parameter: island index when region='connected_component' (see get_mesh_components_detail). |
min_triangle_points |
integer | no | Region parameter: how many of a triangle's 3 points must be inside for it to count, 1-3 (default 3 = fully contained). Only used by the spatial regions. |
invert |
boolean | no | Region parameter: invert a box, sphere, plane or normal_angle selection (default false). |
Returns: { actor_name, material_id, scope, region?: string, triangles_selected?: int, triangles_targeted: int, triangles_painted: int, max_material_id_after: int, distinct_material_ids_after: int, applied: bool, note?: string } -- region and triangles_selected come with scope='region'.
set_mesh_uv_element_position¶
Destructive Idempotent
Set the (u, v) of one element of a UV channel overlay on a DynamicMeshActor's live dynamic mesh in the editor world; an invalid element ID writes nothing, adds no undo step and returns is_valid_element false, not an error. One undo step restores the element; reply actor_name is the component name, not the actor label.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or object name (case-insensitive) of the target DynamicMeshActor in the editor world. |
uv_channel |
number | yes | 0-based UV channel index; a channel the mesh does not have fails the call. |
element_id |
number | yes | ID of the element in the UV overlay of that channel, not a vertex, edge or triangle ID. |
u |
number | yes | New U coordinate of the element. |
v |
number | yes | New V coordinate of the element. |
Returns: { actor_name, uv_channel, element_id, new_position: {u, v}, is_valid_element, set: bool }
set_mesh_uvs_from_projection¶
Destructive Idempotent
Replace the UVs of one channel on a DynamicMeshActor's live dynamic mesh in the editor world with a box, plane or cylinder projection, optionally only inside a region. Box suits plank-and-post geometry (each face takes the axis it faces), plane only flat pieces, cylinder wrapped shapes; projection 'plane' with scale [1,1,1] is a planar projection down mesh-local Z at 1 UV unit per cm. A uv_channel the mesh does not have yet is added first (the channel count only grows, so higher channels such as a lightmap UV1 are kept); uv_channel 8 or more is an error. One undo step restores the previous UVs and channel count. Returns triangles_affected and applied; when the engine reports an error, applied is false, the call fails and the mesh is left as it was.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor. |
projection |
string | no | 'box' (default) | 'plane' | 'cylinder'; planar is accepted as plane. |
uv_channel |
integer | no | UV channel to write, 0 to 7 (default 0); a channel the mesh lacks is added. |
location |
array | no | Local [x,y,z] origin of the projection shape (default the mesh origin). |
rotation |
array | no | [pitch, yaw, roll] of the projection shape (default none). For 'plane', this is what chooses which way the plane faces. |
scale |
array | no | [x,y,z] size of the projection shape (default [100,100,100]). THIS IS THE UV DENSITY KNOB: bigger scale = texture repeats fewer times. A tileable material that reads too big or too small is fixed here, not in the material. |
min_island_tri_count |
integer | no | box only: islands smaller than this are merged into a neighbour (default 2). |
split_angle |
number | no | cylinder only: angle in degrees at which the wrap is split (default 45). |
region |
string | no | Optional region to limit the projection to; same vocabulary as select_mesh_triangles (default 'all'). |
component_index |
integer | no | Island index when region='connected_component'. |
center |
array | no | Region parameter (box/sphere centre, plane origin). |
extent |
array | no | Region parameter: box HALF-size. |
radius |
number | no | Region parameter: sphere radius. |
normal |
array | no | Region parameter: plane/normal_angle direction. |
max_angle_deg |
number | no | Region parameter for region='normal_angle'. |
source_material_id |
integer | no | Region parameter for region='material_id'. |
polygroup_id |
integer | no | Region parameter for region='polygroup'. |
polygroup_layer |
integer | no | Region parameter for region='polygroup': extended polygroup layer index (default the mesh's default polygroup layer). |
min_triangle_points |
integer | no | Region parameter, 1-3. |
invert |
boolean | no | Select the complement of a box, sphere, plane or normal_angle region (default false); the other regions ignore it. |
Returns: { actor_name, projection, uv_channel, region, triangles_affected: int, uv_channel_count: int, uv_channels_added: int, triangle_count: int, vertex_count: int, applied: bool, note?: string } -- applied false with a note, and nothing changed, when no triangle is selected.
set_num_extended_polygroup_layers¶
Destructive Idempotent
Set the number of extended polygroup layers on the live dynamic mesh of a DynamicMeshActor via UGeometryScriptLibrary_MeshPolygroupFunctions::SetNumExtendedPolygroupLayers. Idempotent: the engine dedups (only reshapes attributes when the count actually differs from the current one), so re-setting the same count is a no-op. The layer count is read back AFTER the set via GetNumExtendedPolygroupLayers: applied is true when it equals the request, and the call fails, leaving the mesh as it was, when it does not. One undo step restores the previous layers.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor. |
num_layers |
integer | yes | Desired number of extended polygroup layers (>= 0). |
Returns: { actor_name, requested_num_layers, num_polygroup_layers, applied: bool }
set_num_uv_channels¶
Destructive Idempotent
Set how many UV channels the live dynamic mesh of a DynamicMeshActor in the editor world has: added channels start without UVs, and channels from num_uv_channels upward are discarded with their UVs (note says so). The current count is a no-op (changed false). The engine allows at most 8, so a count above 8 is an error; num_uv_channels is the count read back after the call, and the call fails, leaving the mesh as it was, if it differs from the request. One undo step restores the previous channels with their UVs, nothing saved; reply actor_name is the component name, not the actor label. Fill a channel with copy_mesh_uv_channel or set_mesh_uvs_from_projection; clear_uv_channel works on static mesh assets.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | DynamicMeshActor name (required) |
num_uv_channels |
number | yes | Desired count, 0 to 8 (required) |
Returns: { actor_name: string, num_uv_channels: int, previous_num_uv_channels: int, changed: bool, note?: string } -- actor_name is the dynamic mesh component's name, not the actor label; num_uv_channels is read back; note when channels were removed, whose UV data is dropped.
simplify_mesh¶
Destructive
Simplifies the live dynamic mesh of a DynamicMeshActor in the editor world down toward target_triangle_count with attribute-aware QEM edge collapse, the shape kept as close as the count allows; the engine stops early when no further collapse is allowed, so triangle_count_after can stay above the target. A target at or above the current count, or an empty mesh, changes nothing (simplified false) and adds no undo step; otherwise one undo step restores the mesh. The level is marked dirty, nothing is saved to an asset. An unknown actor or a target of 0 or less is an error. For evenly sized triangles use apply_uniform_remesh, for density driven by a weight map apply_adaptive_remesh; read counts with get_dynamic_mesh_info and keep the result with copy_dynamic_mesh_to_static_mesh.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or object name of the DynamicMeshActor in the editor world (case-insensitive); create one with spawn_actor. |
target_triangle_count |
integer | yes | Triangle count to simplify down to, greater than 0 (e.g. half of the triangle_count get_dynamic_mesh_info reports); at or above the current count nothing changes. |
Returns: { actor_name: string, target_triangle_count: int, triangle_count_before: int, triangle_count_after: int, vertex_count: int, simplified: bool }
transform_dynamic_mesh¶
Destructive
Move, rotate and/or scale every vertex of the live dynamic mesh of a DynamicMeshActor in the editor world about the mesh-local origin with one FTransform via UGeometryScriptLibrary_MeshTransformFunctions::TransformMesh, baking it into the geometry (the actor transform is not touched; calls accumulate), as one undo step that restores the mesh; pass only location (or translation), rotation or scale to apply just that part. A location, translation or scale that is not three numbers, a rotation that is neither three numbers nor a {pitch, yaw, roll} object, or an empty mesh, is an error. An identity transform succeeds with applied false and a note, leaving the mesh unchanged.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor |
location |
array | no | Optional [x, y, z] translation; default (0,0,0) |
translation |
array | no | Optional alias of location, read only when location is absent. |
rotation |
array|object | no | Optional [pitch, yaw, roll] Euler rotation in degrees, or a {pitch, yaw, roll} object; default (0,0,0) |
scale |
array | no | Optional [x, y, z] scale; default (1,1,1) |
Returns: { actor_name: string, location_x: number, location_y: number, location_z: number, rotation_pitch: number, rotation_yaw: number, rotation_roll: number, scale_x: number, scale_y: number, scale_z: number, applied: bool, note?: string }
translate_mesh_uvs¶
Destructive
Offset every UV of one channel on a DynamicMeshActor's live dynamic mesh in the editor world by (translate_u, translate_v), as one undo step that restores the UVs; the level is marked dirty and nothing is saved. Each call adds its offset again, so a retry shifts twice. A zero offset changes nothing (translated false) and adds no undo step. An unknown actor or a channel the mesh lacks is an error and nothing changes. The reply's actor_name is the component name, not the actor label. Scale or rotate the same channel with scale_mesh_uvs or rotate_mesh_uvs; to lay new UVs instead use set_mesh_uvs_from_projection or unwrap_mesh_uvs; get_dynamic_mesh_info shows the channels the mesh has.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or object name (case-insensitive) of the target DynamicMeshActor in the editor world, e.g. 'DynamicMeshActor_0'; spawn_actor with type DynamicMeshActor creates one. |
uv_channel |
number | yes | 0-based UV channel index, e.g. 0; a channel the mesh does not have fails the call. |
translate_u |
number | yes | Offset added to every U coordinate, in UV units: 1.0 shifts by one full tile, 0.5 by half, negative moves left. |
translate_v |
number | yes | Offset added to every V coordinate, in UV units: 1.0 shifts by one full tile, 0.5 by half, negative moves down. |
Returns: { actor_name: string, uv_channel: int, translate_u: number, translate_v: number, translated: bool }
unwrap_mesh_uvs¶
Destructive
Compute a real UV UNWRAP for the whole mesh via UGeometryScriptLibrary_MeshUVFunctions::AutoGeneratePatchBuilderMeshUVs or AutoGenerateXAtlasMeshUVs. This is what sits behind the editor's "Auto UV" button. Use it when a projection is not enough (organic or mixed-orientation geometry); for plank-and-post shapes set_mesh_uvs_from_projection with box is usually cleaner and far cheaper. Both methods PACK the result into standard UV space by default, so island layout is handled too. SLOW on dense meshes: this is a solver, not a projection. A UV channel the mesh does not have, or an empty mesh, is an error; applied is false, and the call fails, leaving the UVs as they were, when the solver reports an error (xatlas needs a compact mesh: run compact_mesh first). One undo step restores the previous UVs.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or name of the target DynamicMeshActor. |
method |
string | no | 'patch_builder' (default, the editor's Auto UV) or 'xatlas'. |
uv_channel |
integer | no | UV channel to write (default 0). |
initial_patch_count |
integer | no | patch_builder: how many patches to seed (default 100). More patches = less distortion, more seams. |
min_patch_size |
integer | no | patch_builder: minimum triangles per patch (default 2). |
merging_threshold |
number | no | patch_builder: patch merging metric threshold (default 1.5). Higher merges more aggressively, giving fewer islands. |
max_angle_deg |
number | no | patch_builder: max angle in degrees between merged patches (default 45). |
respect_polygroups |
boolean | no | patch_builder: seed patches from the existing polygroups instead of curvature (default false). Useful right after add_mesh_primitive, where each appended face is already its own group. |
auto_pack |
boolean | no | Pack the resulting islands into standard UV space (default true). |
max_iterations |
integer | no | xatlas: solver iterations (default 2). Higher is slower and slightly tighter. |
Returns: { actor_name, method, uv_channel, triangle_count: int, uv_channel_count: int, applied: bool }
weld_mesh_edges¶
Destructive
Weld the coincident open boundary edges of a DynamicMeshActor's live dynamic mesh in the editor world (actor found by label or object name), merging boundary edge pairs whose endpoints lie within tolerance so cracks and duplicated seams close. The mesh changes in place as one undo step that restores it, and nothing is saved; a mesh with nothing to weld (closed, or no pair within tolerance) is a success with welded=false and adds no undo step. welded is true when the vertex or triangle count dropped; a failure the engine's welder reports makes success false and leaves the mesh as it was. A negative tolerance or an unknown actor is an error. Count open edges first with get_dynamic_mesh_info (num_open_border_edges); self-intersections: repair_mesh_self_intersections; orphan vertices: remove_unused_vertices; persist the result with copy_dynamic_mesh_to_static_mesh.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Label or object name of the DynamicMeshActor in the editor world (case-insensitive). |
tolerance |
number | no | Largest distance, in the mesh's local units (cm before actor scale), between the endpoints of two boundary edges for them to be welded; must be >= 0 (default 1e-06). |
only_unique_pairs |
boolean | no | When true (default), weld only edges that have exactly one coincident partner; false also merges ambiguous matches. |
Returns: { actor_name: string, tolerance: number, only_unique_pairs: bool, triangle_count: int, vertex_count: int, welded: bool }