21 C
New York
Sunday, September 21, 2025

rendering – Meshes should not seen after including them to an actor scene element


I wrote a Python script to connect a mesh to a scene element of an actor (vegetation_root_component)

  • Within the logs every little thing appears to be like high-quality, however no mesh seems added to the actor
  • If I transfer the actor within the scene, it disappears, not a great signal
root_transform = vegetation_root_component.get_world_transform()

# Rework world location to native
local_location = root_transform.inverse_transform_location(hit_location)
local_rotation = root_transform.inverse_transform_rotation(unreal.Rotator(0,0,0))

# Make a rework for the mesh
rel_transform = unreal.Rework(location=local_location, rotation=local_rotation, scale=unreal.Vector(1,1,1))

# Add a brand new StaticMeshComponent to the actor
sm_component = unreal.StaticMeshComponent(actor)
sm_component.set_relative_transform(rel_transform,sweep=False, teleport=True)

# Set static mesh
sm_component.set_static_mesh(random_mesh)

# Connect to vegetation root
hooked up = sm_component.attach_to_component(
    vegetation_root_component,
    socket_name="",
    location_rule=unreal.AttachmentRule.KEEP_RELATIVE,
    rotation_rule=unreal.AttachmentRule.KEEP_RELATIVE,
    scale_rule=unreal.AttachmentRule.KEEP_RELATIVE,
    weld_simulated_bodies=True
)

notes:

  • hooked up is True
  • hit_location is a line hint end result. It seems on the mesh with a debug sphere
LogPython: blocking_hit=True
LogPython: hit_location=
LogPython: hit_actor=

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles