When Spawning new actors via the SpanActor Blueprint node, initial transform must be supplied to the SpanActor node, and not defined in the spawned Actor Class’s Blueprint.
Just found out the hard way, that when you spawn an Actor using the SpawnActor blueprint node, the transform data connected to the SpawnActor node is actually applied after the actors Construction Script and BeginPlay Event.
This means any transform you will try to apply in the spawned Actor’s Blueprint will be overridden and therefore not work.
from unreal import Vector
lst_actors = unreal.EditorLevelLibrary.get_all_level_actors()
print('place actors at 0 z')
for act in lst_actors:
act_label = act.get_actor_label()
if 'Sphere_' in act_label:
act_location = act.get_actor_location()
act_bounds = act.get_actor_bounds(False)
act_min_z = act_bounds.z - act_bounds.z
location_offset = Vector(act_location.x, act_location.y, act_location.z - act_min_z)
act.set_actor_location(location_offset, False, False)
* note that when copying and pasting a script from this example, the indentation may not be pasted correctly.
The get_actor_boundsunreal.Actor class method returns a tuple object containing 2 unreal.Vector objects, the first being world space location of the actor geometric center, and the second is the corner of the bounding box relative to the center.
I’ve been operating 3ds max for 20 years and this always gets me by surprise again and again, especially when working with students 🙁
In the past, the option to hide/show the Transform Gizmo had a hot key X, and curiously, even though that way it would happen more frequently that the Gizmo would disappear by mistake, when it was X I actually remembered it, and remembered to tell my students to just press X.
The menu command: VIews > Show Transform Gizmo
I never remember it,
And also, I can’t logically except that it’s a system setting that is kept even when resetting the scene or opening a new file.
How to get an object transformation matrix relative to another object’s coordinates:
* The following script requires selecting 2 objects, the function will return the transform matrix of the first object relative to the transform matrix of the second.