unreal.GeometryScript_MeshSpatial
¶
- class unreal.GeometryScript_MeshSpatial(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
BlueprintFunctionLibrary
Geometry Script Library Mesh Spatial
C++ Source:
Plugin: GeometryScripting
Module: GeometryScriptingCore
File: MeshSpatialFunctions.h
- classmethod build_bvh_for_mesh(target_mesh, debug=None) -> (DynamicMesh, output_bvh=GeometryScriptDynamicMeshBVH)¶
Builds a Bounding Volume Hierarchy (BVH) object for a mesh that can be used with multiple spatial queries.
- Parameters:
target_mesh (DynamicMesh) –
debug (GeometryScriptDebug) –
- Returns:
output_bvh (GeometryScriptDynamicMeshBVH):
- Return type:
- classmethod find_nearest_point_on_mesh(target_mesh, query_bvh, query_point, options, debug=None) -> (DynamicMesh, nearest_result=GeometryScriptTrianglePoint, outcome=GeometryScriptSearchOutcomePins)¶
Finds the nearest point (Nearest Result) on the Target Mesh to a given 3D point (Query Point) by using the Query BVH.
- Parameters:
target_mesh (DynamicMesh) –
query_bvh (GeometryScriptDynamicMeshBVH) – a BVH associated with the Target Mesh
query_point (Vector) – a 3D location relative to the local space of the mesh
options (GeometryScriptSpatialQueryOptions) –
debug (GeometryScriptDebug) –
- Returns:
nearest_result (GeometryScriptTrianglePoint): on return, holds the nearest point on the mesh to the QueryPoint
outcome (GeometryScriptSearchOutcomePins): will be either Found or Not Found depending on the success of the query. Note NearestResult.bValid will be false if the query failed.
- Return type:
tuple
- classmethod find_nearest_ray_intersection_with_mesh(target_mesh, query_bvh, ray_origin, ray_direction, options, debug=None) -> (DynamicMesh, hit_result=GeometryScriptRayHitResult, outcome=GeometryScriptSearchOutcomePins)¶
Finds the nearest intersection of a 3D ray with the mesh by using the Query BVH. Note, depending on the Ray Origin and Ray Direction, there is the possibility that the ray might not intersect with the Target Mesh. Should the ray miss, the HitResult.bHit will be false and the Outcome will be Not Found.
- Parameters:
target_mesh (DynamicMesh) –
query_bvh (GeometryScriptDynamicMeshBVH) –
ray_origin (Vector) –
ray_direction (Vector) –
options (GeometryScriptSpatialQueryOptions) –
debug (GeometryScriptDebug) –
- Returns:
hit_result (GeometryScriptRayHitResult):
outcome (GeometryScriptSearchOutcomePins):
- Return type:
tuple
- classmethod is_bvh_valid_for_mesh(target_mesh, test_bvh, debug=None) -> (DynamicMesh, is_valid=bool)¶
Checks if the provided Bounding Volume Hierarchy (BVH) can still be used with the Mesh — it generally returns false if the mesh has been changed.
- Parameters:
target_mesh (DynamicMesh) –
test_bvh (GeometryScriptDynamicMeshBVH) –
debug (GeometryScriptDebug) –
- Returns:
is_valid (bool):
- Return type:
- classmethod is_point_inside_mesh(target_mesh, query_bvh, query_point, options, debug=None) -> (DynamicMesh, is_inside=bool, outcome=GeometryScriptContainmentOutcomePins)¶
Tests if a point is inside the mesh using the Fast Winding Number query and data stored in the BVH.
- Parameters:
target_mesh (DynamicMesh) –
query_bvh (GeometryScriptDynamicMeshBVH) – is an acceleration structure previously built with this mesh.
query_point (Vector) – the point in the mesh’s 3D local space.
options (GeometryScriptSpatialQueryOptions) – control the fast winding number threshold
debug (GeometryScriptDebug) –
- Returns:
is_inside (bool):
outcome (GeometryScriptContainmentOutcomePins):
- Return type:
tuple
- classmethod rebuild_bvh_for_mesh(target_mesh, update_bvh, only_if_invalid=True, debug=None) -> (DynamicMesh, update_bvh=GeometryScriptDynamicMeshBVH)¶
Rebuilds the Bounding Volume Hierarchy (BVH) for the mesh in-place, which can reduce memory allocations, compared to building a new BVH.
- Parameters:
target_mesh (DynamicMesh) –
update_bvh (GeometryScriptDynamicMeshBVH) –
only_if_invalid (bool) –
debug (GeometryScriptDebug) –
- Returns:
update_bvh (GeometryScriptDynamicMeshBVH):
- Return type:
- classmethod reset_bvh(reset_bvh) GeometryScriptDynamicMeshBVH ¶
Reset the Bounding Volume Hierarchy (BVH) by clearing all the internal data.
- Parameters:
reset_bvh (GeometryScriptDynamicMeshBVH) –
- Returns:
reset_bvh (GeometryScriptDynamicMeshBVH):
- Return type:
- classmethod select_mesh_elements_in_box_with_bvh(target_mesh, query_bvh, query_box, options, selection_type=GeometryScriptMeshSelectionType.VERTICES, min_num_triangle_points=3, debug=None) -> (DynamicMesh, selection=GeometryScriptMeshSelection)¶
Create Mesh Selection of mesh elements in TargetMesh contained by QueryBox, using QueryBVH to accellerate the computation. Triangles are selected if MinNumTrianglePoints or more vertices are inside the box. PolyGroups are selected if any of their triangles are inside the box
- Parameters:
target_mesh (DynamicMesh) –
query_bvh (GeometryScriptDynamicMeshBVH) – is an acceleration structure previously built with TargetMesh.
query_box (Box) –
options (GeometryScriptSpatialQueryOptions) – control the fast winding number threshold
selection_type (GeometryScriptMeshSelectionType) –
min_num_triangle_points (int32) –
debug (GeometryScriptDebug) –
- Returns:
selection (GeometryScriptMeshSelection):
- Return type: