# Geo Nodes: How to calculate tangent of mesh

I want to align instances along a displaced mesh. The problem is that the (red) instances always point in the same direction no matter where they are positioned. The instances should be aligned to the tangents (or maybe the normals?) of the mesh, so every instance gets the correct rotation. In the Screenshot I drew (green arrows) how I think it should look like.

I know how to calculate the tangent of a CURVE but I don't know how to do this with a mesh. Thank you for your help. I also attached the blend file:

## 1 Answer

try this:

and to make it "look good" you should move your cone in edit mode, so that the pivot point is at the bottom:

...because the cone will rotate around that point.

result:

be aware that the result might look wrong (but it isn't) because you scaled the cones so much, that it might not be clear where the face midpoint is on which the cone is positioning itself.

So if you scale down the cones a bit, a looks "better":

Note:

you should do the following: the scale of your object is -12.7807 on XYZ. I would apply the scale with Ctrl+A. Since the scale was negative, you now have to go into Edit Mode and recalculate normals by selecting all faces and pressing Shift+N. Another problem is, you are not instancing the cone object itself but the collection of the cone. So when you for example move the cone it will not stay on the surface. So either instance the object or if you want to keep using the collection, you should enable Separate Children and Reset Children.

• Hmmm... strange: when I try it, I don't need the Align Euler to Vector node. Actually I can simply plug the Rotation output of the Distribute Points on Faces node into the Rotation input of the Instance on Points node. The Align Euler to Vector only works for me if I use the Rotation input instead of the Vector input - then I have to set the Pivot to Z. But the result is the same as I wouldn't use the node at all. Which Blender version are you on at the moment? I'm using 3.2.0 Jul 4, 2022 at 14:48
• As you know…the newest alpha - 3.3 🙈 Jul 4, 2022 at 14:52
• And doesn't it work there without Align Euler to Vector? But apart from that I have to fix so many other things to make the spikes show up... I have to reduce the density of the distribution since my PC doesn't seem to like that many instances, and I have to unplug the scale from the lower node tree etc. Jul 4, 2022 at 14:57
• In my test it didn’t work without align. But as you can see in my node tree I unplugged his rotation and just use that align value…🙃 Jul 4, 2022 at 14:59
• Yeah, me too. And I don't know what the scaling is all about, but the last nodes before plugging into the Scale input is first combining XYZ to a Vector only to then plug it in a single value multiply node, where it's multiplied by -0.1 so that it gives a negative scale...? Jul 4, 2022 at 15:03