This is a continuation of an old thread from 2014, here:
Applying collision to multiple models? - World Creation - Epic Developer Community Forums
I’m using the python plugin by Roberto De Loris to generate collisions for multiple meshes (Thanks for the tip ex3me).
Source: GitHub - 20tab/UnrealEnginePython: Embed Python in Unreal Engine 4
Currently with one mesh selected in the scene, I run the following Python:
import unreal_engine as ue
from unreal_engine.classes import StaticMesh, StaticMeshComponent
actors = ue.editor_get_selected_actors()
print(actors)
staticMesh = actors[0].get_component_by_type(StaticMeshComponent)
aggregateGeom = staticMesh.StaticMesh.BodySetup.AggGeom
struct = aggregateGeom.get_struct()
print(aggregateGeom.as_dict())
#LogPython: {'SphereElems': [], 'BoxElems': [], 'SphylElems': [], 'ConvexElems': []}
print(aggregateGeom.set_field("ConvexElems"))
#LogPython:[]
This generates no collision and prints the following:
[<unreal_engine.UObject object at 0x000000000652FF60>]
{'SphereElems': [], 'BoxElems': [], 'SphylElems': [], 'ConvexElems': []}
set_field() takes at least 2 arguments (1 given)
Traceback (most recent call last):
File "<string>", line 11, in <module>
TypeError: set_field() takes at least 2 arguments (1 given)
I’ve tried with only one mesh or multiple meshes selected and get the same outcome.
Looking at lines 7 and 8 where I guess the action is supposed to be I see nothing but variable assignments so I’m not sure how this supposed to do anything anyway!
I’m kinda stumped!
Any help much appreciated!
Cheers, Graham