Hello! This is my first project in Unity and I’m trying to make my character throw balls into the goal (which is a wall without the mesh renderer) which will increment the score.
The following is the picture of the characteristics of the goal: It is a rigidbody and a trigger.
The following is the picture of the characteristics of the ball: It is a rigidbody following Unity physics.
The following is the script I’ve attached to the ball:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GoalDetector : MonoBehaviour {
/*public void onCollisionEnter(Collision other)
{
if (other.gameObject.tag == "Ball")
Debug.Log ("Goal!!!!");
Destroy(other.gameObject);
Destroy(gameObject);
}*/
public void onTriggerEnter(Collider other)
{
//if (other.gameObject.tag == "Goal")
Debug.Log ("Goal!!!!");
//Destroy(other.gameObject);
//Destroy(gameObject);
}
}
I have tried making the wall as a non trigger, tried using kinematics followed the Unity documentation on Collision between two objects here. What am I doing wrong??
hi;
oh man u just have a simple problem here :
onTriggerEnter
it should be :
OnTriggerEnter
with big O 