Touch React System Pro

Touch React System Pro

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 Pro 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.

Settings Tab
Editor Tab
Debug Tab
Adding touch react to your scene
Touch React Collider Component
Touch React Mesh Component
Requirements

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.

By adding a TouchReactCollider component to the boat you can force the grass to only grow up to the boat.

Settings Tab

 

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.

Buffer Resolution

Select the resolution of the touch buffer. Larger buffer gives better resolution on large areas but will take more time to render.

Affected Area

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.

Editor Tab

 

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 TouchReactSystemPro component. There should normally be no need to change anything on the camera.

Debug Tab

If you enable the “Show colliders/meshes” checkbox everything that will bend the grass will show up as green in the sceneview.

Touch react debug mode enabled and disabled

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

Normal GameObjects

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.

Collider scale

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.

Effect of touch react enabled on a character with a ragdoll and colliders. The scale is increased a bit in order to properly hit the vertexes of the grass

Same scene with touch react turned off. You can almost not see the character in the grass.

Refresh colliders

Press refresh colliders if you change or update the colliders run-time.

[enlighter lang=”csharp”]

//get a reference to the TouchReactCollider and call
touchReactCollider.RefreshColliders()
//to do the refresh in script.

[/enlighter]

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.

Requirements

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.