Just gonna get straight to the point as I assume its a simple answer I just can’t work out.
I have this script which i’m currently using:
private void OnCollisionEnter(Collision collisioninfo)
{
if (collisioninfo.collider.tag == "Obstacle")
{
Destroy(gameObject);
}
if(collisioninfo.collider.tag == "Destroyer")
{
Destroy(gameObject);
}
Lets say the Script is ScriptA and the obstacle is testobject1
ScriptA is on testobject
The problem I have is that sometimes the destroyer (the object in which the testobject1 touches to cause it to destroy) can get catch on the testobject1 its trying to clear. So I wanted to convert the destroyer to a trigger so that it doesn’t have the collider on it, however what I’ve tried does’t work. I need it to be able to destroy a whole variety of objects for example testobject2, testobject3 and testobject4, when it goes in the box collider’s area. so a script which could go on the destroyer would be ideal if that is possible, but if it has to be each individual object, that works to. Thank you for any help you can give me, not matter how small. Even if its just a point in the right direction.