Untitled
unknown
python
10 months ago
1.7 kB
7
Indexable
#===========================================================================
# * set_pivot_center_bottom()
# *
# * Purpose:
#===========================================================================
def set_pivot_center_bottom(input_sm:unreal.StaticMesh,outline_actor:unreal.Actor):
if outline_actor==None:
return
stdio.printf('set_pivot_center_bottom() -- Start')
asset_options = unreal.GeometryScriptCopyMeshFromAssetOptions()
requested_lod = unreal.GeometryScriptMeshReadLOD()
dm = unreal.DynamicMesh()
unreal.GeometryScript_AssetUtils.copy_mesh_from_static_mesh(input_sm,dm,asset_options,requested_lod)
mesh_bounds = input_sm.get_bounds()
center = mesh_bounds.origin # we need to keep this somewhere as we lose world positions when pivot is bottom center.
extent = mesh_bounds.box_extent
bottom_center = unreal.Vector(center.x, center.y, center.z )#- extent.z)
stdio.printf(f'DynamicMesh = {dm}','[SPCB]')
stdio.printf(f'Location = {center}','[SPCB]')
stdio.printf(f'Extent = {extent}','[SPCB]')
stdio.printf(f'Bottom Center = {bottom_center}','[SPCB]')
dm.translate_pivot_to_location(bottom_center)
outline_actor.set_actor_location(center,False,False)
options = unreal.GeometryScriptCopyMeshToAssetOptions()
target_lod = unreal.GeometryScriptMeshWriteLOD()
unreal.GeometryScript_AssetUtils.copy_mesh_to_static_mesh(dm,input_sm,options,target_lod)
#unreal.EditorAssetLibrary.save_asset(input_sm)
stdio.printf('set_pivot_center_bottom() -- End')Editor is loading...
Leave a Comment