need trigger + collide

Hi there. i have some [fireBall] which have rigidbody and checked as Is Trigger.

Then player have code like this:

unction OnTriggerEnter( hit : Collider )
{
if(hit.gameObject.tag == “respawnPoint”)
{
dead = true;
HealthControl.LIVES -= 1;
}

if(hit.gameObject.tag == "enemyProjectile")
{
	gotHit = true;
	HealthControl.HITS += 1;
	Destroy(hit.gameObject);
}

}

everything is fine, just how should i do, that fireBall would collide on walls or terain? Becouse now fireBall is going through terain, walls, mountains, etc…

Thank you very much.

This is happening because you’ve set Is Trigger to true. It seems you need a trigger to detect “respawnPoint”, but usually it’s not a good thing the “enemyProjectile” to be a trigger. Uncheck Is Trigger in the FireBall object and detect it in OnCollisionEnter (or OnControllerColliiderHit, if the player is a Character Controller):

function OnTriggerEnter( hit : Collider ) { 
  if(hit.gameObject.tag == "respawnPoint") { 
    dead = true;
    HealthControl.LIVES -= 1; 
}

function OnCollisionEnter( hit : Collision ) {
// function OnControllerColliderHit( hit : ControllerColliderHit) {
  if(hit.gameObject.tag == "enemyProjectile") {
    gotHit = true;
    HealthControl.HITS += 1;
    Destroy(hit.gameObject);
  }
}

Yeah, firstly i used: OnControllerColliderHit( hit : ControllerColliderHit)

but problem is If i want the code to work with OnControllerColliderHit (), i need to move with my playerCharacterController. If I stand still, when enemyProjectile hits player, nothing happens.