I’ve created a simple 2d tennis game. The game detects collision from the ball. If the ball hits the paddle it plays a sound and determines the direction that the ball will be sent to the other side. When a ball hits both the upper boundary and the paddle at the same time no collision is detected. Any insight on how I can get the collider to work?
I included some code and video. In the video the first hit does not fire off the “if ((col.gameObject.tag == “paddle”” when it hits the paddle and the wall at the same time.
void OnCollisionEnter2D(Collision2D col ) {
foreach(ContactPoint2D contact in col.contacts){
Debug.Log("col");
// Hit the left Racket?
if ((col.gameObject.tag == "paddle" && noman == false) {
audio.Play();
if (noscore == false){
player1Score++;
noscore = true;
}