# Crash when enabling physics on Groom Asset with Python

**URL:** <https://forums.unrealengine.com/t/crash-when-enabling-physics-on-groom-asset-with-python/1134618>\
**Category:** Editor Scripting\
**Tags:** unreal-engine, question\
**Created:** [April 20, 2023, 1:48pm UTC](https://forums.unrealengine.com/t/crash-when-enabling-physics-on-groom-asset-with-python/1134618 "2023-04-20T13:48:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TomInterdigital](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TomInterdigital](https://forums.unrealengine.com/u/TomInterdigital)\
**Post date:** [April 20, 2023, 1:48pm UTC](https://forums.unrealengine.com/t/crash-when-enabling-physics-on-groom-asset-with-python/1134618/1 "2023-04-20T13:48:40Z")

</div>

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 :

```auto

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 !

---

<div class="post-metadata">

**Author:** ![zhengyi.wyh](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@zhengyi.wyh](https://forums.unrealengine.com/u/zhengyi.wyh)\
**Post date:** [February 29, 2024, 3:03am UTC](https://forums.unrealengine.com/t/crash-when-enabling-physics-on-groom-asset-with-python/1134618/2 "2024-02-29T03:03:14Z")

</div>

It seems that one or the other will do, enable\_global\_interpolation or enable\_simulation\_cache

---

<div class="post-metadata">

**Author:** ![zhengyi.wyh](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@zhengyi.wyh](https://forums.unrealengine.com/u/zhengyi.wyh)\
**Post date:** [February 29, 2024, 3:03am UTC](https://forums.unrealengine.com/t/crash-when-enabling-physics-on-groom-asset-with-python/1134618/3 "2024-02-29T03:03:53Z")

</div>

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

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

```
