Scene Graph Parent Child
Parent one entity to another and the child moves WITH the parent: attach a weapon to a hand, lights to a ship. The hierarchy makes groups move as one.
In UEFN you can attach one game object to another — like bolting a lantern onto a ship. Nest the child under a parent, and wherever the parent goes, the child rides along.
Think of a blueprint that stamps out a ship with lights welded on. The ship is the parent; the lanterns are children. Move the ship and every light follows automatically — they're one group.
We call Lantern.GetParent to find the ship it's nested under. GetParent can fail if there's no parent, so we gate it with the if-brackets. Once we have the parent, we can read its transform — the lantern's whole world is driven by it.
Parent an entity to another and they move as one — that's how hierarchies keep your ships, lights, and weapons glued together.
ShipEntity := Lantern.GetParent[]
if (Parent := Lantern.GetParent[]):
ShipPos := Parent.GetTransform().Translation
Print("Lantern rides with its ship")
Build your own lesson with scene_graph_parent_child
Generate a personalized, compile-checked lesson grounded in this exact reference.
Build a lesson →