0
$\begingroup$

I wanted that the grass turn in the Z axe to avoid collision with the box when this last moves.

I try several options but I do something wrong and it doesn't work.

My Geometry Nodes My Geometry Nodes

Any idea how to do it?

Thanks for your help :)

$\endgroup$

2 Answers 2

3
$\begingroup$

You approach is wrong. What you get out of the proximity node is a list of distances for each face of the mesh you are trying to rotate. Then you are feeding it to the transform node that wants you to input only one rotation vector (because you are rotating the whole geometry, not separate points). That said, you need to input a single vector value, not a list of them (you can see that there are multiple entries and not a single one by looking for dashed links). You can also see what is required to input by looking for the shapes of input sockets. Circular means single value, Diamond means a list.

For this particular case I dont think you need proximity node at all. You basically just need to create a vector that tells you from which direction the box is nearing your geometry. Rotate this vector 180° along the z-axis at the origin of your geometry and then align the geometry with this new vector.

enter image description here

The result:

enter image description here

$\endgroup$
3
  • $\begingroup$ Thanks Jiří for your explanation, I was a bit confused and now I understand better. Anyway, what I need is that the grass turn when the box hits it. In the other cases the grass must not be moved. $\endgroup$ Commented Apr 12, 2023 at 11:36
  • $\begingroup$ In that case what I provided you is a good starting point. You'll probably want to measure the length of the vector and apply the rotation only when the length is short enough for the box to collide with your geometry. You can also change the 180° to something smaller or even make the angle gradual. I don't think physical collisions are yet implemented in GN so you'll have to make do with this kind of mathematical approach. $\endgroup$ Commented Apr 12, 2023 at 11:43
  • 1
    $\begingroup$ You could also try to do it per Vertex with the proximity node (which would give you more realistic results). In that case instead of transform node you'll need to use set position node and calculate new vectors for each point separately $\endgroup$ Commented Apr 12, 2023 at 11:45
1
$\begingroup$

With Jiří's help I found a way to make it work.

It's not perfect and only works correctly if you move the box in one direction.

enter image description here

The new GN.

enter image description here

Now I just need to fine tune it.

$\endgroup$
1
  • $\begingroup$ awesome:) can you close the question? $\endgroup$ Commented Dec 18, 2023 at 14:20

You must log in to answer this question.

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