- Home /
API for swaying in the wind...
Can I somehow get scripting access to the current wind "bend" values, which vary from moment to moment, at a particular location?
Motivation: So I have a lovely terrain with grass and trees that sway in the wind. I also have some special plants with skinned meshes that I control entirely through scripts. The scripts are pretty involved and allow the plants to jiggle and stretch, etc. in interesting ways when the player interacts with them. But I'd also like these rigged plants to sway back and forth in sync with the wind, just like the standard Unity grass and trees that surround them. In order to do that, I think I need frame-by-frame access to what the wind is doing to the surrounding grass/trees.
Answer by AlwaysSunny · Mar 08, 2015 at 07:38 AM
Last I knew, unity's implementation for "wind" was not exposed for scripting in any way. (It's all done in the vegetation shader, IIRC). You could use the same vertex manipulation implementation that the built-in shader uses to drive your custom veggies, (duplicate the hidden/nature/whatever shader as the basis for your custom shader) but I'm 90% sure that's the only way to sync their motion.
Good question, I'd like this feature as well. Along with a few dozen others. ;)