Trying to get an “Air Vent” type of effect to work. I had this working in 3d space but I’m running into problems making it work in 2D.
using UnityEngine;
public class OnStayTrigger : MonoBehaviour
{
[SerializeField]
private float airPower = 10;
void OnTriggerStay(Collider _col)
{
if (_col.tag == "Player")
{
Rigidbody2D rb = _col.GetComponent<Rigidbody2D> ();
rb.AddForce(Vector3.up * airPower, ForceMode2D.Impulse);
}
{
if (_col.tag == "Enemy")
{
Rigidbody2D rb = _col.GetComponent<Rigidbody2D> ();
rb.AddForce(Vector3.up * airPower, ForceMode2D.Impulse);
}
}
}
}