OnTrigger/Collision

I have a sphere which moves across a hall,and when it hits the player it reappears at it’s initial position.The problem I am currently facing is that it only works if the player is moving,if he doesn’t move the ball passes him .I am kinda new to unity and checked online but didn’t find anything…

#pragma strict

private var Speed =0.35;

function Update () {
      transform.position.z-=Speed;
      if(transform.position.z<=-73){
      transform.position = new Vector3(-150.71, 3.5, 35.98);
      }
      }
function OnTriggerEnter(other:Collider){
if(other.gameObject.name=="Player"){
      transform.position = new Vector3(-150.71, 3.5, 35.98);
}
}

You should use OnTriggerStay(). Always search for related pages from documentation. :wink: