9
$\begingroup$

I have this scene in where the trees are falling down in a radial fashion:

enter image description here

How can the Z-axis of the trees to be aligned so that the trees would fall like so:

enter image description here

.Blend file:

NOTE: The falling trees spreading is animated by using scene time

$\endgroup$
4
  • 1
    $\begingroup$ There's no particle system in your file, but have your tried to create a Force Field > Force with a negative Strength? $\endgroup$
    – moonboots
    Apr 11 at 10:02
  • $\begingroup$ @moonboots I would like to keep using Geometry Nodes for this, the trees are made of just one trunk and one branch, which I like $\endgroup$ Apr 11 at 10:03
  • $\begingroup$ @ManuJärvinen By the way, you can achieve a soft curve AND a performance increase if you change the structure a bit. See answer below. ;-) $\endgroup$ Apr 23 at 13:31
  • $\begingroup$ @quellenform Excellent, excellent, yes I can see you updated the post since I last saw it. Great stuff! $\endgroup$ Apr 23 at 13:39

2 Answers 2

11
$\begingroup$

You could subtract their positions from the central cylinder, align them to that vector, and take the Z value from that alignment. Object Info should be in Relative mode:

enter image description here

Because you're using a grid for base distribution, that creates "river"s of blank space though, maybe you'd like to scramble their initial positions first? If that's something you'd like to get rid of, obviously.


Update: Noticed that one part of the circle was pointing the opposite way with my setup. That's because of your proximity object's Z position not being $0$. Resetting its position gets rid of it, but if it's, say, a spaceship landing in a forest it'll have to have a Z height so to permanently solve the problem, you can "flatten" the subtraction vector (by multiplying its Z value with $0$):

enter image description here

$\endgroup$
3
  • $\begingroup$ Wow, how elegant! Thank you! Also thanks for the scrambling suggestion! :) $\endgroup$ Apr 11 at 10:40
  • $\begingroup$ @ManuJärvinen You're welcome. I noticed a small problem with the setup, and updated the answer with a solution. PS I follow you on Twitter, and enjoy seeing your project updates so I'm glad I could help you out a little in one of them :) $\endgroup$
    – Kuboå
    Apr 11 at 10:49
  • $\begingroup$ Haha wonderful, thank you! And thanks for updating! - Soon I’ll try it out! $\endgroup$ Apr 11 at 10:52
11
$\begingroup$

The difference to other solutions: With this variant, you also get a soft curve (controllable with the Float Curve node) when the trees fall, and the angle can be limited to a certain range!

If you use Geometry Proximity to calculate the distance, you have the following options:

  1. First scale a duplicate of your cylinder on the X and Y axis to a very small value. This is the object you use for Geometry Proximity because if you used the original object, the trees inside the object would fall inward instead of outward.

  2. Calculate the direction of a tree to the center with the node Substract (vector). Scale this value in one direction or the other, depending on where you want the trees to fall. The cross product of this direction and the up-vector is then your axis, for your rotation.

  3. As angle for this rotation you use the value Distance you got from the Geometry Proximity node. Depending on how you change this value, you can achieve a smooth falling of the trees (in this example I used the Float Curve node for this).

  4. Instead of feeding the Align Euler to Vector node with the angle, use Rotate Euler instead, because this gives you the possibility to control the rotation optimally! In addition, you have the option here to include a previously created rotation of the objects.

  5. You then only need to pass the resulting value directly as a rotation when instantiating the objects with the node Instance on Points.

    This example shows the change in the radius of action as a function of the timeline:

    Changing Radius

    And this example shows the result when the cylinder is approached:

    Cylinder Proximity

Here is an overview of the node group:

The entire Node Group


UPDATE!

I also took the liberty of making a few changes to the node groups in your file:

  • I created the individual trees with their own node groups and put a few variations of them into a collection. This way you have much tidier groups and can create new variations more flexibly.
  • I solved the instantiation of the branches on the tree trunk using a float value, so that you can always choose a different area per variation instead of having to create a vertex group in the mesh.
  • I took the rotation of the single trees out of the tree group and applied it together with the rotation created by Geometry Proximity during instantiation. This will give you a unique rotation for each instance.
  • I didn't create the instantiation exactly at the faces of your grid, but randomly within your grid. This makes the trees look much more natural and not so strung out.

The advantage of this restructuring is that it is not only more flexible and clearer, but also runs more performant and you can achieve more than a doubling of the frame rate (5fps with your variant, and 12fps with my solution).

Here is the blend file:

$\endgroup$
2
  • $\begingroup$ That is awesome ! How could I tweak this to ignore the Z position of the cylinder ? I want the trees to flatten only depending on the X and Y position. Thanks! $\endgroup$
    – gordie
    Apr 14 at 14:47
  • $\begingroup$ @gordie ...since I'm working with a scaled copy of the cylinder here, you could simply set the Z position to 0 in the transformation (right before the "Geometry Proximity" node). This would give the Geometry Proximity node only the X/Y coordinates for reference. $\endgroup$ Apr 14 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.