Orient mapping to world Z

Hi Grasshoppers
Still in my infancy with GH, but trying to make little usefull things. I’ve got these imported trees where the mapping is all screwed. Trying to automate applying the mapping to each individual mesh face (which works), but I’m now stuck on getting the orientation right. All of the cherries are supposed to be hanging, but as you can see, only one of the faces have the right orientation.

So I’m looking for some help on how to get mapping for all the surfaces to “follow” the world Z axis.
TIA, Jakob
gh question.gh (19.0 KB)


Hi @Joseph_Oster
Is the screengrab to indicate that I’m not allowed to use plugins in Grashopper and then ask questions on the forum - or should I have listed the plugins used in the original post? As mentioned, I’m not a very seasoned GH user, so beg my pardon if I overstepped the GH Discourse super user ruleset.

It’s just a notice for others to say they won’t get far on your model without these plugins.

1 Like

For the occasion you need mapping to Planes derived from Mesh Vertices or from Mesh Face Centers (where Plane Z is the global Z). In order to do it you should compare any Vector3d angle (a Normal, a ref Vector (say: Global positive Z)) then get the filtered Vertices, then define mapping Planes and then Orient your things FROM Plane.WorldXY (the standard way) TO any mapping Plane.

Used a little code in the attached (Components are not my game at all):

CMap question.gh (78.4 KB)

Other than that … this is not the way to do it: for real-time speed (and lot’s of other reasons) you should map Instance Definitions since we are talking about the same objects (and/or some optional Trasformations [Scale, Rotate etc]). That way you can finish the job in a couple of milliseconds with, say, 1-2K “complex” Instances. But this is more or less outside your envelope at present time.

1 Like

Hi @PeterFotiadis
Thanks a lot - I think that will get me what I’m looking for :slight_smile: Much appreciated!

Do some things more:

  1. Mastermind a way to visualize the Normals, thus to have a clue about the suitable min/max angles to use.
  2. Get what the little C# does and replace it with native Components.
  3. Implement some Transformations (like Rotate) more and/or a Random policy to apply them.
  4. Use more Groups of things to map and sample the candidate objects via some optional Random way
  5. Replace the Mesh with some Graph (say a “tree” like for the occasion).

As a challenge … since you operate in the Industrial Design sector … think the most absurd/complex installation imaginable … and we’ll see ways to make the impossible very easy.