How to move an object

Hi guys.
First, I apologize for my poor English.

I am working on a project, which I have to use my accelerator of a smart phone, and use the data to control my First Person Controller.
My problem is, when I use my script,
the First Person Controller will walk through other object and terrain,
or touch the object, but it doesn’t stop, and it just like the First Person Controller is PUSHING the object.

But when I use the same First Person Controller and close my script, it doesn’t have any problem.
Here is some code of my script

if(-0.75<inputX&&inputX<-0.45)
  transform.Translate(4*Vector3.left*Time.deltaTime);
else if(-0.45<inputX&&inputX<-0.15)
  transform.Translate(2*Vector3.left*Time.deltaTime);
else if(0.15<inputX&&inputX<0.45)
  transform.Translate(2*Vector3.right*Time.deltaTime);
else if(0.45<inputX&&inputX<0.75)
  transform.Translate(4*Vector3.right*Time.deltaTime);

where inputX is the data I get from the accelerator of the smart phone.

Can anyone tell how to fix it? Thanks.

This is related to how you have your GameObject setup and the fact that you are using Translate instead of a physics based movement.

To make something interact properly with the world around it we need a “non kinematic” Rigid body and a proper collider (in case of 2d, you need the 2d variants of them both), then instead of using the transform to move around, use the rigidbody.MovePosition, this movement will take in consideration the physics of the world.