transform.collider.isTrigger problem

I want to do something like if it hits a wall the trigger would be false,if it is an enemy, it is true. I am having a problem with this because when my enemy hits the wall, the trigger will be false forever in the game… how can I make it as it is only false if it hits the wall and only true if it hits my character .

I guess you want to have a look at the OnTriggerEnter method on your camera collider.
Then check the object parameter to check if it’s an enemy, then you can do what you want to do.

You need to Set up Tags and Setup OnTrigger Enters and Exits.

Something Like this I think.

function OnTriggerEnter(col:Collider){
  if(col.tag == "Player"){
    collider.isTrigger = false;
  }
  if(col.tag == "Enemy"){
    collider.isTrigger = true;
  }
}
function OnTriggerExit(col:Collider)
{
  if(col.tag == "Player"){
    collider.isTrigger = true;
  }
  if(col.tag == "Enemy"){
    collider.isTrigger = true;
  }

}

Implement bot OnCollisionEnter and OnTriggerEnter. Do the tag check on both, and toggle isTrigger. I’m not sure what you’re trying to achieve, but you could probably do it properly with physic layers.

Please next time, try being more clear in your problem description.