Skip to content

A town simulation in pale isometric line art, implemented with Ritmo ECS and PixiJs 3D

Render: the scene's node registry attaches under the parent node

SandroMaglione0230af7fcf3d
diff --git a/src/render/three/scene.ts b/src/render/three/scene.ts
index 919d7e2..6bcc5bd 100644
--- a/src/render/three/scene.ts
+++ b/src/render/three/scene.ts
@@ -185,9 +185,11 @@ export class GameScene {
}
registry<T extends SceneNode>(): NodeRegistry.NodeRegistry<T> {
return NodeRegistry.make<T>({
- attach: (node) => {
+ // `parent` is the parent entity's node under a `RenderSync` hierarchy (none is given today): every node is on the root.
+ attach: (node, parent) => {
+ const into = parent?.group ?? this.objects
this.nodes.add(node)
- this.objects.add(node.group)
+ into.add(node.group)
},
detach: (node) => {
this.nodes.delete(node)