I’ve made a script for a pinball bumper and it works fine for the first contact but afterwards the pinball will not make contact and fall through. Does this have to do with the material of the bumper or the way OnTriggerEnter works?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BumperScript : MonoBehaviour
{
public int bumperForce = 800;
private GameObject player;
// Use this for initialization
void Start () {
Debug.Log ("found");
player = GameObject.FindGameObjectWithTag ("Ball");
}
public void OnTriggerEnter (Collider collider)
{
if (collider.gameObject == player)
{
Debug.Log ("collision");
player.GetComponent<Rigidbody> ().AddExplosionForce (bumperForce, transform.position, 1);
}
}
// Update is called once per frame
void Update () {
}
}