Object goes trough everything (Teleporting?)

I have a little big problem. I’m making a game and i need an object to follow the player when not seen, everything is working fine except for 1 thing… The object moves trough the floor, walls and everything on it’s way without giving a single fuck about it (like a baws). Idk if it’s because of the LookAt or the Translate variables, but i think the second one causes it. It’s like it teleports instead of moving behind the player.

Here is the script:

#pragma strict
 var player : Transform;

 var statue : Transform;

 var speed : float = 0.5;
 
 var RockDragging: AudioClip;
    
function Update(){

 if(renderer.isVisible == false){

	 statue.LookAt(player);

     statue.Rotate(player);
	 
	 statue.Translate(speed*Vector3.forward);
	 
	 audio.clip = RockDragging;
	 
	 audio.Play();
	 
	}

}

function OnBecameVisible() {

     audio.clip = RockDragging;

     audio.Pause();
     
}

The first thing I notice is that you are using transform.Translate which ignores physics. If you want it to collide with other objects, both involved objects should have colliders, and you should use ridgedbody.AddForce to move said objects.

More than likely you will have to set up a form of path-finding too, and I have no experience with that.


Edit

I know that I can blabber at times, so let me make a checklist to clear things up:

  1. Check that the moving object is a rigidbody. (tutorial)
  2. Check that both the moving object and the player have colliders. (tutorial)
  3. Set the statue variable to a RigidBody instead of a Transform
  4. Set the object to move with AddForce instead of translate (tutorial)

Final script should look something like this:

#pragma strict
var player : Transform;
var statue : Rigidbody; //redefined Transform to Rigidbody
var speed : float = 0.5;
var RockDragging: AudioClip;
function Update(){
	if(renderer.isVisible == false){
		statue.LookAt(player);	     
		statue.Rotate(player);	     
		statue.rigidbody.AddForce(speed*Vector3.forward); //changed movement by translate to addforce    
		audio.clip = RockDragging;	     
		audio.Play();	     
	}     
}     
function OnBecameVisible() {
	audio.clip = RockDragging;
	audio.Pause();  
}
//I reformated to what I'm used to. There is no need to change your formating.
//If there is a syntax error, I appologize. I almost exclusively use C#.