How can I lerp between materials in any direction
My levels are modular and all ground tiles share the same material. The material basically lerps between two different textures. It works in editor and I've managed to hook it up to script as well- so far so good.
Where I really struggle is getting the right direction. I need to lerp in the direction the player is walking. If the player is walking over a tile, the lerp needs to start on the location where the player touched the ground and follow them as they walk over the ground tile. The player can only walk in 90 degree directions.
I figured I could set up 4 bools to check each direction and then see which side the player is coming from in code and then use the split node R or split note B to get two directions, but I still miss the reverse of both those directions.. It also seems unnecessarily convoluted but I don't see a better way.
I'm fairly new to unity but would really appreciate any direction on how I can go about this.
Thanks
Your answer
![](https://koobas.hobune.stream/wayback/20220613024751im_/https://answers.unity.com/themes/thub/images/avi.jpg)