1
$\begingroup$

I'm currently trying to create simple level geometry for a game I'm working on. I've seen people use cubes with extrusions and then overlay those meshes with bricks and tiles to quickly create buildings.

I've already looked into it and this is what I have right now:

Current progress

Gif

As you can see, it isn't quite working as planned.

The way I achieve this is by checking the angles and direction of the edges to see what is horizontal vs vertical. Then turn the mesh into curves and using them to create mesh or place instances along those curves.

Nodes for horizontal curves

The main issue I have right now is that the instances I place on the cornes are not aligned properly and I have a hard time finding a solution for this. I've looked at some tutorials about aligning instances to normals, but it doesn't quite work in this specific scenario. This is what I have right now:

Instances along edges

The whole Transfer Attribute > Align Euler To Vector just doesn't give the right result, even with different combinations.

So my question is: How do I get the right orientation for the instances on the corners?

I'm also very new to Geometry Nodes and especially new to what I'm trying to create right now, so tips and tricks are very welcome also.

Link to the .blend file:

$\endgroup$
2
  • $\begingroup$ if u provide blend file i will try to find a solution...but i am too lazy to rebuild your setup... $\endgroup$
    – Chris
    Commented May 8, 2022 at 10:03
  • $\begingroup$ I added the .blend file to the question. $\endgroup$
    – RensPitman
    Commented May 8, 2022 at 12:22

1 Answer 1

4
$\begingroup$

Basically, it is only a matter of deciding on a certain direction for a rotation, according to which the stones are then aligned.

I would solve it like this:

  1. First get the normals of the faces and form the cross product with the up vector. This will move the vertices all in a certain direction.

    enter image description here

  2. If you form from these directions again the cross product with the X-axis and the Y-axis, you get further directions with which you can work.

    enter image description here

  3. From the directions created before you can then, with a little logic, calculate a precise direction that runs along a wall.

    enter image description here

  4. Finally, you use this direction, in conjunction with the rotation resulting from the node Curve to Points, with the node Align Euler to Vector and pass the resulting value to your instances.

    enter image description here

Note that the center of the objects to be instantiated is also important.

Here is the relevant group at a glance:

enter image description here

And here is the blend file:

$\endgroup$
3
  • $\begingroup$ wow, this is a bunch of vector math. Looks nice. +1 $\endgroup$ Commented May 8, 2022 at 22:52
  • $\begingroup$ This is indeed what I was looking for! I'm interested in how it works. I did notice that it sometimes swaps back to the old orientation, even with straight edges $\endgroup$
    – RensPitman
    Commented May 9, 2022 at 10:46
  • 1
    $\begingroup$ @RensPitman Updated the nodes, now it works as expected ;-) $\endgroup$
    – quellenform
    Commented May 9, 2022 at 14:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .