I’m trying to create a Simple Extrude Polygon within a python script and add it into the world. I’ve tried adding the generated mesh into the world in several different ways however none seem to ever create a mesh & fail. Does anyone know where I’m going wrong?
EAL = unreal.EditorAssetLibrary
ELL = unreal.EditorLevelLibrary
ARH = unreal.AssetRegistryHelpers
AT = unreal.AssetToolsHelpers.get_asset_tools()
generatedMesh = unreal.GeneratedDynamicMeshActor(name = "Test")
mesh = unreal.DynamicMesh()
mesh.set_editor_property('enable_mesh_generator',True)
polyCoords = []
for point in shapely.get_coordinates(geom):
utmPoint= utm.from_latlon(point[1],point[0])
polyCoords.append(unreal.Vector2D(utmPoint[0],utmPoint[1]))
mesh.append_simple_extrude_polygon(primitive_options = unreal.GeometryScriptPrimitiveOptions(polygroup_mode = unreal.GeometryScriptPrimitivePolygroupMode.PER_FACE,
uv_mode = unreal.GeometryScriptPrimitiveUVMode.UNIFORM),
transform = unreal.Transform(location=[0.0, 0.0, 0.0],rotation=[0.0, 0.0, 0.0], scale=[1.0, 1.0, 1.0]),
polygon_vertices = polyCoords,
height = heightValue)
generatedMesh.on_rebuild_generated_mesh(mesh)
ELL.spawn_actor_from_object(generatedMesh, location = (0,0,0))
There is a lot more testing in this file with some other ways to try and do this so I apologise if some of the code to make this code ‘work’ is missing