# Transform letters by their instances in geo nodes

I'm doing text animation in geometric nodes. I'm trying to animate the letters around their center, but all the transforms are only applied relative to the bottom left corner. Is it possible to do transformations from the center of the letter? Blender 3.0

I'm trying to make a random rotation of each letter from the center point

• Do you spawn the text inside the geometry node tree using String to Curves node? We need more details to help Jan 20 at 16:31
• You need to pivot on the bounding box center rather than the origin. Jan 20 at 17:56

## Blender 3.0

• move letters apart,
• use Bounding Box node to get a cube for each letter,
• remove all but top face from each cube,
• for each instance find the nearest face coming from the Bounding Box (that's why letters have to be moved apart, so the right face is matched),
• take the position of that face, which is the center of the bounding box,
• rotate around that center,
• move letters back together.

• It looks like it's working as it should. I wouldn't have thought of that myself, thank you! Jan 20 at 21:22
• I'm loving this method, and I can't see anything wrong with its logic. But I'm intermittently getting 'misses' on the pivot-point .. some chars rotating around the wrong pivots. Dependent on string. Varies with different separation methods. It's looking like a bug in 'Nearest'? Even if my separation is huge, it persists. Late here, so will look again tomorrow. Can you tell me your Blender version? Me: 2021-12-03 3.0, Linux. Jan 20 at 22:35
• @RobinBetts 2021-12-02 18:35 f1cca3055776 Windows. If you get a wrong face, then perhaps the Delete Geometry deletes wrong faces? Maybe you spawn your text aligned with a different axis? I'd like to see your setup and test if I can reproduce your problem on my end. Jan 21 at 10:16
• @RobinBetts I debugged it: find the setting when the rotation is wrong, connect the Realize Instances after Bounding Box to the Group Output, and you can see there's no face. This is probably due to floating point quirkiness... So the solution is to add Math > Greater Than 0.001 node between the Distance and Delete Geometry. Jan 21 at 15:46
• @RobinBetts in general comparing floats without a threshold is a dangerous game... Though lately I try to investigate when exactly the threshold is needed... For example, according to the IEE 754 standard, the result of subtracting two identical floats must be 0. However, C++ is one of the languages that doesn't comply with the IEE 754 standard fully (depends on compiler flags AFAIK). Still, in this case the problem comes from the normals sometimes not being exactly 0;0;1: You can see that if you apply the geomod for b.box and print(*(p.normal.z for p in C.active_object.data.polygons)). Jan 21 at 16:11

If you're prepared to use a recent Blender 3.1a, a couple of new nodes make this method possible. You can type in your text as a single object.. it will be interpreted as a Mesh by GN.

Then, this set of nodes will spin each mesh island in Y, around its mean X, by the input Angle:

There might be some edge-cases requiring more nodes, for example where characters are more than one island, off-center .. but something based on this may do the trick.

Blender 3.1a, at answer's date.

• Thanks for the answer, but for now I need to deal with the 3.0 version :) Jan 20 at 21:10
• @Kogoduos Okydoky... I don't think the 3.1 release is too far off. Jan 20 at 21:11
• if there is no convenient way in 3.0, then I will take your way Jan 20 at 21:14
• Wow these new utility nodes are awesome ! Jan 21 at 6:45
• Seeing your nice animation and great answer i thought you wrote "Instagram" :D :D :D Mar 9 at 14:02

Because you didn't post the node tree I can only give you a generic answer. It should be enough to point you in the right direction.

### The reason their Origins are bottom left

By default instances use the origin of the instanced geometry. Blender can't guess where you wish the origins for the letters were, it can only work with the coordinates you're actually passing to it.

If your text has a bottom left origin because the original text mesh was created using a Left, Top Baseline alignment that's how the instances will be spawned.

### Solution 1: Text-specific method

Create the text using a Center, Middle alignment. This method will center the letter relative to the text's line-height. It'll make the origin of the various bits of text consistent, but it won't return the real, geometry origin.

Depending on what you're doing you'll want to use this method.

### Solution 2: Generic geometry method

To set the text on its real geometric origin you'll need to figure out its width and height, then halve it by 2 an multiply it by -1 to offset it in the correct direction.

The old way to do this was to perform calculations on the Min/Max of a Bounding Box. Thanks to the new Attribute Statistic node, you can simply grab its Mean point.

• In Solution 2 you realize instances, and then look for the mean of all vertices - it will give you the center for a single letter string, but not individual centers for individual letters (and how could it move multiple letters so the origins are in their means, if there's only one origin since the instances are realized?) Jan 20 at 19:22
• Thanks for the detailed answer. I've added a node tree. The first solution is not suitable, and I tried use the second for my task, but didn't work Jan 20 at 20:55