I want to make a bounce platform. I tried to figure it out myself but no luck. I got it to work somewhat, but for some reason it would only work if I entered the trigger from the left side. So after trying different things this is what I have right now and its not doing anything. This is probably the wrong way to do it, so any suggestions would help.
public float bounciness;
void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Player")
{
GameObject player = GameObject.FindGameObjectWithTag("Player");
player.GetComponent().AddForce(Vector2.up, ForceMode2D.Force);
}
}
↧