Hello there, new to Unreal in light of recent events.
Is it possible to somehow automatically generate collision mesh on all imported geometry when importing fbx? I can see that it generates some simple geometry, but it has huge offsets. What works for me is convex hull generation, but I can only do that per each geometry in fbx individually. My fbx consists of 140 models inside and going through each on individually is a huge pain. Is it possible to somehow automate it? using c++ api maybe?
tried chat gpt for some help and it suggested python script, but it doesn’t work. method DataprepSetConvexDecompositionCollisionOperation in unreal package doesn’t exist.
import unreal
import os
operation = unreal.DataprepSetConvexDecompositionCollisionOperation()
operation.set_thresholds(unreal.DataprepSetConvexDecompositionCollisionThresholds(0.1, 1000, 100000))
recipe = unreal.DataprepRecipe()
recipe.add_operation(operation)
folder_path = "D:\Projects\MedievalMadness4\Content\Art\Trees\Tree_01\Meshes"
static_meshes = get_static_meshes_in_folder(folder_path)
for static_mesh in static_meshes:
result = unreal.DataprepLibUtils.apply_recipe_to_static_mesh(recipe, static_mesh)
def get_static_meshes_in_folder(folder_path):
static_meshes = []
files = os.listdir(folder_path)
for file in files:
full_path = os.path.join(folder_path, file)
if unreal.EditorAssetLibrary.does_asset_exist(full_path) and \
unreal.EditorAssetLibrary.does_asset_support_editor_view(full_path):
asset_data = unreal.EditorAssetLibrary.find_asset_data(full_path)
if asset_data.is_valid() and asset_data.asset_class == unreal.StaticMesh.static_class():
static_meshes.append(asset_data.asset_name)
return static_meshes