Skip to content

Instantly share code, notes, and snippets.

@LordNed
LordNed / ReactiveGrassSway.cs
Last active April 13, 2022 21:17
A 2D grass that sways and springs back when you walk through it or land on it. Place onto a 2D quad.
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(BoxCollider2D))]
public class ReactiveGrassSway : MonoBehaviour
{
[SerializeField] private float m_bendForceOnExit = -0.1f;
[SerializeField] private bool m_windIsEnabled;
[SerializeField] private float m_baseWindForce = 0f;
[SerializeField] private float m_windPeriod = 0f;