Crash when enabling physics on Groom Asset with Python

Hello everyone,

I’m want to enable the physic simulation on many assets so I want to automate it. I did it with Python, I can modify the gravity value for exemple, but when i enable physics, the engine crash, here is the code :


import unreal
import os

grooms_path = "/Game/assets/grooms/automated_imports"

EAL = unreal.EditorAssetLibrary()

asset = EAL.find_asset_data('/Game/assets/grooms/automated_imports/groom')
asset = asset.get_asset()

forcesSettings = unreal.HairExternalForces()
forcesSettings.set_editor_property('gravity_vector', [0, 0, -9.81])

solverSettings = unreal.HairSolverSettings()
solverSettings.set_editor_property('enable_simulation', True)

physics = unreal.HairGroupsPhysics()
physics.set_editor_property('solver_settings',solverSettings)
physics.set_editor_property('external_forces',forcesSettings)

print(asset)

asset.set_editor_property('hair_groups_physics', [physics])

Do you have an idea why ? or have you same similar things ?

Thanks !

It seems that one or the other will do, enable_global_interpolation or enable_simulation_cache

I have the same issue and finally solve it by setting enable_global_interpolation or enable_simulation_cache true of groom before setting enable_simulation,I hope it helps

# asset.set_editor_property('enable_global_interpolation', True)
asset.set_editor_property('enable_simulation_cache', True)