How can I have texture animations only when camera moves?

I have a material set up at this moment where the texture is animated normally but is there a way to only have the animation be active when the camera moves?


The only way I see, is to bind it to a blueprint, in which you change the material parameter making your animation… animate (replace your time variable if I understood correctly).
So, in the Begin Play, you catch a reference to your camera and check each tick if your camera transform has changed, if so then update your material parameter.
It should work, isn’t it?

Is there no way to have it be active in editor without blueprint? Or is there a node in the material editor that disables the animation when there’s no camera movement detected?

Not sure at 100% but it will surprise me a lot that such function/constant exist.
Maybe someone will correct me then.

I’m also pretty sure there is not a material function for that and you have to do it like Begounet described.

What kind of animation does your material have? Flip book/sprite sheet, scrolling textures, rotating textures?

Can you give an example under what circumstances would you like to play the animation only as long as the camera moves?

Right now I have a lightwall which I want to have the lights turn on and off randomly when you move the camera (sort of light a sparkle effect but then with light points). I was thinking of doing this with an animated cloud but I can only get the panner node working instantly and not when just moving the camera. I have also tried doing this with a noise node which works as I want it to but with that I can’t get the noise restricted to only the light sources. It goes all over the place as is expected by a noise node.

You can make this effect in material only. You can use camera position material expression. It gives you world space position of the camera. Then you need to check if texture pixels, that represent lights on the wall, are within certain range from the camera. If so, you turn them on. There is a boxmask3d material function, that allows you to make smooth in-out transition. You can overlay this mask with any kind of noise, to get pseudo-random effect.

Do you perhaps have any reference for me? I’m fairly new to material setups and have only used the camera position node once. How do I get the pixel location and distance from a texture?

I’m curious about this too