Touch React System
Touch React System
Vegetation Studio has a Touch React system that allows grass and flowers to bend when in contact with selected meshes or colliders in the scene. To enable this add a TouchReactSystem component to a GameObject in the scene. There should be only one of these components in the scene. When adding Vegetation Studio to the scene one is created by default.
If you are not planning to use touch react system just disable the component or remove it.
The touch react capability can be added to Objects or Large Objects spawned by the VegetationSystem component or any GameObject with a collider or Mesh.
It is also possible to do advanced rendering using a custom material to a layer invisible to the main camera. See the Car track guide linked below.
Video showing a car set up with a touch material on a Trail Renderer to create a persistent track in the grass. See this guide for a more detailed look at setting up the car tracks.
Auto Select Camera
By default Camera.MainCamera is used for touch React area selection. Disable checkbox to select camera manually. The area around the camera is rendered to a TouchReactBuffer that is used by the custom grass shader.
Touch React Layer
Select a layer not seen by the game cameras. This layer is used to render meshes and colliders to the touch buffer.
Select the resolution of the touch buffer. Larger buffer gives better resolution on large areas but will take more time to render.
Affected area is the ortho size of the camera used to render the touch buffer to GPU. a size of 50 will affect 25 meters in radius from the camera.
Disable the “Hide TouchReact Camera” checkbox to show the Camera rendering the touch buffer in the inspector hierarchy.
The camera is created and configured by the TouchReactSystem component. There should normally be no need to change anything on the camera.
If you enable the “Show colliders/meshes” checkbox everything that will bend the grass will show up as green in the sceneview.
Colliders and Mesh
Count of colliders and meshes include all added by normal GameObjects. Vegetation Items rendered instanced to the touch buffer will not show up in the count.
Adding touch react to your scene
Touch react can be enabled on any Object or Large Object added to a VegetationSystem Component. The objects mesh will be drawn instanced direct to the Touch React Buffer. To enable just select the object in the Vegetation System Component.
Enable “Enable touch react” checkbox to enable.
Any GameObject in the scene with a Collider or a MeshFilter can be used with touch react.
Touch React Collider Component
Add child colliders
With Add child colliders checked the component will add and render all colliders in the GameObject and children to the Touch React buffer.
When disabled only colliders on the GameObject will be used.
It can sometimes be useful to scale up the effect of colliders. In cases with many and small colliders like ragdolls you will get better effect with a bigger scale of the colliders rendered to the buffer. To get head and body overlapping etc. Play with the scale until you get the effect you want.
Press refresh colliders if you change or update the colliders run-time.
//get a reference to the TouchReactCollider and call touchReactCollider.RefreshColliders() //to do the refresh in script.
Touch React Mesh Component
Add the TouchReactMesh collider to any GameObject with a MeshFilter. The mesh in the mesh filter will be rendered to the touch react buffer and grass will bend.
In order for touch react to work with grass or flowers they need to be using Vegetation Studios custom grass shader. You can add Texture 2D grass, plants or Flowers direct to the Vegetation Studio Component or customize them using the Grass Patch Generator that makes mesh patch grass patches with built in LOD.