How to rotate instances to face another object? (geo nodes)

Hello.

I have a set of instances to form a crowd of people, and I am trying to get them to face another object.

Is it possible to do this? I have this setup so far, but this is adding random rotation to instances (would be good for a random crowd of people milling around). I’ve tried all sorts of mucking about with normal captures etc., but I can’t figure this out.

Hi!
Plug the vector into Vector input in “Align Euler to Vector” node.
Don’t forget to choose the right Axis as well (the one that describes “front” of the character)

Thanks for the suggestion. I tried the vector socket, but this seems to make it worse. Everyone looks like they are doing that Michael Jackson lean, no matter how I alter the align to Euler axis:

can u pls provide blend file so we don’t have to guess? thx.

Sorry I can’t supply the original as the blend file is a large project with a lot of meshes I have worked on for some time.

I have however attached the node tree with some simple meshes as a blend (3.6LTS).

Rotate Instances.blend (980.3 KB)

I think the scale of your emitter object messes things up. Apply it?
Other than that, what I said above still applies:

5 Likes

It’s close, but it is not aligning instances to the object, rather than giving some broad control of how they face in a single direction.

For example, you can get them to face each other:

The only values of scale that seem to matter are <0.1, 0, and >0.1 (this flips the direction that each side of instances is facing).

Replace that Vector Math - Multiply node with a Vector Math - Normalize and then set the Pivot of the Align Euler to Vector node to Z. The Vector Math - Scale node is also redundant. You can simply switch the inputs of the Subtract node, if you want to switch the direction.

2 Likes

First: I only meant to use the Scale -1 node to flip the direction (you’d get the same thing by swapping Subtract inputs). It’s not meant to be anything other than “-1” :face_with_raised_eyebrow:

Second: you seem to have eliminated a whole X dimension with Multiply node? (0, 1, 0). Why tho?

4 Likes

you can try this node setup:

The cones are smaller because i applied scale + rotation.

1 Like

OK, I have got it working now with the following node setup:

There is a strange offset between where the meshes are facing and where the reference object is, but this can be fixed by moving it.

Thanks all for the help.

Use the Relative option in the cylinders Object Info node instead of Original

2 Likes