Get Value of a Material Input in Blueprint?
I have a Material named "WaterMaterial" and a Blueprint called "Water_Surface". The water material contains some math to set the World Position Offset which makes the material look like it's splashing up down. Meanwhile, my blueprint as a Collision Box that is parented to the box I've applied the WaterMaterial to.
I need accurate collision on the water_surface, which means I need my collision box to move with the WaterMaterial box.
I'm struggling to find a way to grab the World Position Offset value. Is there any way I could do that through blueprints?
Attached is an image of the code that's driving my World Position Offset value inside the WaterMaterial.
asked May 04 '15 at 11:01 PM in Blueprint Scripting
Hi, you can get the value of a scalar or vector parameter stored in a material via a blueprint, but there is no path to get a value solved by the material for a specific position like you are asking. It is still doable though with a different approach.
What you need to do in this case is replicate the sine waves in your blueprint and synchronize the time variable. You could try using "get real time in seconds" or better use a timeline or deltatime on tick in the eventgraph to increment a global parameter in a material parameter collection. Or drive a material instance dynamic. As long as time and the values of your parameters and math are the same, you will get accurate wave height. Also account for any additional Z offsetting that may need to come from actor position.
Follow this question
Once you sign in you will be able to subscribe for any updates here