Rotate Mesh To Face Camera

Hello, I am trying to create a materiel that will rotate a mesh only on the X axis to face the camera. I have found an example by Epic to do this on the Z axis but I cannot figure out how to convert to X (or Y). I cannot do this wilth blueprints, I have to use the material.

Custom Node:

float2 output; 
float2 Input1; 
output = atan2 (In.y,In.x); 
return (output);

Change the multiply node to be 0,1,1
Change atan2 to be (In.Z, In.Y)

You may need to change 0.25 to something else, depending on how the coordinates work out.

This is fantastic! Thank you!
There is one problem with this however, I rotate the mesh via code around the Z axis, but this messes up the material. Do you know of a way to get both to work together?

What happens to the material when you use this?

How would one change this to rotate on all axis, to have it completely camera-aligned?

I made a working blueprint for a material that will always face the camera. When applied, the mesh will rotate around the Z or X axis. Attached is a screenshot of the blueprint. Plug the output of either “RotateAboutAxis” into the World Position Offset of the material to to select which axis to rotate around.

The advantage of this blueprint is that the image scales (billboard images don’t scale in the editor) and there is no “Custom” function used. Other blueprints I’ve seen also have the problem of the image not scaling.

I’m hoping someone can help me get both to work together so that this will act the way billboards do and always face the camera in all axis. Currently my blueprint will only rotate in one axis to face the camera.