Geonodes Translating mesh edge angle to node rotation

Hi! I’ve been using geometry nodes to build city blocks that instance pre-made shapes on blocks. I’ve made a few variants of them, but I’m working on one that’s proving a bit tricky.

Some of the blocks I need to make have angled edges (all the others I’ve built are right- angled.) as below:

So far I’ve split it into several sections to try and make it work (probably a really hacky way) First of all I subtracted the difference in the y and -y lengths to create a chunk which I can drop my right angled block generator into as below:

Then I created a similar block with the remainder:

And masked out everything but the edge I need:

And then I created another ‘block’ which uses the length of the angled edge as its width:

And masked out everything but the edge I need:

But what I’d like to know is, how do I find out the angle of the angled edge and how can I translate that to the rotation of the final ‘block’ as below:

Here’s my node set up. The divide/multiplies are so I can keep my dimensions consistent with the scale of the instances I’m using.

1 Like

Hello again)

“Edge Vertices” are coming to the rescue once again!
By subtracting positions you will find a Vector pointing from one vertex to the other. In one direction or the other - it [probably] should not matter in this case.

Another helpful node is “Align Euler to Vector”.
It returns a Rotation from some Axis to input Vector. In my example I rotate X-axis to the edge.

With that you can then rotate and set Positions of the block… at least if simply rotating around the Origin.
(Or, if it’s an Instance, plug the rotation straight into Rotate Instances node).

1 Like

Hey again!

Thanks for the quick reply and for the advice again!

Unfortunately I’m not getting any rotation when I replicate your node set up and plug it into my block. I tried toggling through the indices on the sample index node but my block is just staying in the same position.

Actually it is sortof working (must have had something disconnected. But the results are kinda crazy.

vertex 0:


Vertex 1:

Vertex 2 (The actual rotated edge)

Vertex 3

Actually, I’ve figured it out!

Instead of plugging into the vector rotate and set position, I plugged the output of the sample index into the ‘translate geometry’ node from the third block node tree!

Thanks for the advice! Workng nicely now!

2 Likes