Hi, I have imported a large model from Revit, and I then wrote a python script that successfully applied DOP simplified collisions to all the thousands of actors. Here is part of one of the walls.
How can i stop the routine from creating mesh across the doorways, so that we can ‘walk around’ it in 3rd person?
Here’s the code i used, it does a basic job ok.
import unreal
asset_path =‘/game/…’
def add_box_collision (static_mesh):
# You could instead use .SPHERE, .CAPSULE, .NDOP10_X, .NDOP10_Y, .NDOP10_Z, .NDOP18, .NDOP26
shape_type = unreal.ScriptingCollisionShapeType.NDOP10_X
unreal.EditorStaticMeshLibrary.add_simple_collisions(static_mesh, shape_type)
unreal.EditorAssetLibrary.save_loaded_asset(static_mesh)
get a list of all Assets in the path.
all_assets = unreal.EditorAssetLibrary.list_assets(asset_path)
unreal.EditorFilterLibrary.by_class(all_assets,“Doors”,not,“”,“true”)
load them all into memory.
all_assets_loaded = [unreal.EditorAssetLibrary.load_asset(a) for a in all_assets]
filter the list to include
only Static Meshes.
static_mesh_assets = unreal.EditorFilterLibrary.by_class(all_assets_loaded, unreal.StaticMesh)
run the function above on each Static Mesh in the list.
list(map(add_box_collision, static_mesh_assets))