Requires the full Nature Shaders package.
Not supported in Nature Shaders Essentials. (Learn more)
Vegetation that uses the "Grass" or "Plant" shader can interact with other objects in the scene. The vegetation will be pushed down when an object moves through it, and will sway behind the object once it has passed.
Note that interaction is not supported for trees and is recommended only for small grass/plants. As a general rule of thumb: if the plant is larger than the player then it probably should not have interaction enabled.
Follow these steps to enable interaction:
For the vegetation object:
Recommended: Create a Nature Asset for your prefab or model to automatically set up interaction.
For manual setup, follow the steps below:
- Select the material of the vegetation, and ensure that it is using the "Nature Shaders/Grass" or "Nature Shaders/Plant" shader. Note: For URP and HDRP the shaders are in the "Universal Render Pipeline" or "HDRP" sub-category.
- Scroll down to the "Interaction" section in the material editor, and enable interaction.
- The interaction feature needs to know the shape of the model to correctly calculate interaction with objects. The shape is loaded from the Mesh section in the material. If you created a Nature Asset then this will be set up automatically, if you manually created the material then you may have to tweak the object size and radius in the Mesh section.
- (Optional) Tweak additional settings in the material, such as the interaction strength, the time it takes for the vegetation to settle, or others. See the Material Editor article for a full list of settings that can be tweaked for the material.
For scene objects:
- Select the game object in the scene that you want the vegetation to interact with.
- Add a collider to the game object, if it does not have any colliders. The colliders are used for interaction.
Tip: Set up a Collision Layer if you want the collider to only interact with vegetation and not with other objects.
- Add a Nature Collider component. This component will register the colliders on the object as colliders that should interact with vegetation.
Note: Only the colliders on the same game object are registered. Colliders in children are not registered.
- That's it, the vegetation should now interact with the object and sway when the object moves around. Both in edit-mode and at runtime.