Scaling individual instances to face width

Hello,

I’m struggling to understand how geometry nodes separate instances from each other and how they can be modified individually. I’m building a room generator with geometry nodes and my approach is to extrude a shape for the room from a cube, instance a wall piece on each face and then scale the instance to fill the face.

I can only scale all the instances by the same amount. The height of the wall pieces don’t match the height of the box but this is fine for now, I only want to get the walls working.

Below is my node setup

Any help on this is greatly appreciated.

This is my node setup, the site wouldn’t let me post more than one image in the post

This may be what you’re after - Geometry Nodes: Scaling Objects in a Collection to Fit Faces

Thank you @dan2! This is exactly what I was looking for. Had to tweak a few things here and there but got it working as intended.
What an involved solution for a problem that sounds pretty trivial on paper.