# This is a simple structure for our Lamp Post
# It shows how entities relate to each other
# 1. Define the main family (The Entity)
struct LampPost:
# This is the parent object
Pole: MeshComponent
# This is the child object
Light: MeshComponent
# 2. The Setup Function
# This runs when you place your prefab on the map
Initialize(LampPost) -> void:
# Set the pole to be a tall cylinder
LampPost.Pole.Mesh = CylinderMesh
# Set the light to be a small sphere
LampPost.Light.Mesh = SphereMesh
# Move the light on top of the pole
# The light is a child, so it moves with the pole!
LampPost.Light.Position = (0, 0, 5)
Verse Library
verse
01 Fragment
Creates parent-child mesh hierarchies and initializes component properties for custom prefab structures.
verse-library/building-an-entity-hierarchy-with-the-scene-graph/01-fragment.verse