Material world position relative to object?

I have a material for cloth that is setup to animate it’s vertices based on some interpolating noise to make it look like it’s blowing in the wind.

It works great, however when i attach it to a moving object, the movement of the object influences the material due to it using the WorldPosition node.

Is there a way to lock it to the object (and that objects rotation) so it is fixed to the object?

I’ve tried subtracting the ObjectWorldPosition node from the WorldPosition, but that doesn’t help (I assume because of the variable rotation of the object).

Thanks in advance.

Never mind. I ended up just using the texture coordinate for the vertex animation and tiling it to the correct UV to get it to look nice.

I’d be interested in seeing what you came up with. Here’s one of my cloth meshes from a few years ago.

I used one vertex color channel to multiply how far the vertices move. I might have used another color channel to limit whether the cloth will move below its start, so that it doesn’t clip through the wood.

I know you don’t need it anymore but if you ever need it again:

  • Transform your WPO nodes from local to world if you need position+rotation+scale to be relative to the object
  • Subtract Object WorldPosition from WorldPosition (like you said) if you just need to get the position

looks very nice.