Create a cube with 8 vertices and add it to an actor blueprint. Color the upper vertices red and the lowers ones black.
Create a parameter collection (red circle in the picture)
Now create a material for your cube, I took the wireframe material from the engine content.
Make an instance and apply it to the cube in the actor blueprint.
Here’s the material graph(right click and “open in new tab” to display in full size):
Now change the actor blueprint accordingly:
Of course, the “hello” print was just a test. And I still don’t know what takes more performance. Checking if the vector length isn’t zero, or setting the value for the parameter collection. So maybe, the branch takes more performance, than it gets. I probably should have saved the vector length in another var and then feed the branch with an “equal float to zero”-check.
Now hit simulate and drag your actor blueprint at the X or Y axis.
Let me know, if you it didn’t work for you. It works pretty good for me.
edit: The “lagBehindVector” variable on the right is a “Linear Color” type. Your can split the blue input by right click it and “split struct pin”