game object ignores collider

var hit : RaycastHit;
var raypoint : Vector3;
var getcoor = false;

function Update(){
	if(Input.GetButtonDown("Fire1"))
	getcoor = true;
	if(Input.GetButtonUp("Fire1"))
	getcoor = false;
	
	if (getcoor)

		{
		var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
		if(Physics.Raycast(Camera.main.ScreenPointToRay (Input.mousePosition), hit))
			{
				raypoint = hit.point;
				
			}
		}
	transform.position = Vector3.Lerp(transform.position, hit.point, Time.deltaTime);
}

I am using this code to move my game object around on a plane. The code let me move my game object wherever I click. But the problem is, it (the game object) ignores anything that i put on the plane (e.g. going through colliders and etc…). Does anyone knows how to make the physics work? p.s: FYI, FixedUpdate() won’t work too.

If your object is not a Character Controller, just add a rigidbody and it will collide with other objects (I’ve just tested the script in my project). The default rigidbody (with Use Gravity checked and Is Kinematic unchecked) is OK.

EDITED: The Character Controller must be moved with 1 or SimpleMove in order to detect collisions. I modified your original script to use a character controller, and cut out some redundancies (one Raycast instead of two, GetButton instead of GetButtonDown/GetButtonUp, etc.). Now it detects collisions, and also has a fake gravity (a constant down velocity instead of a real acceleration). The variable speed adjusts the moving speed (the actual velocity will be also proportional to the distance):

var hit : RaycastHit;
var raypoint : Vector3;
var speed = 10;  // move speed
var gravity = 10;  // fake gravity

private var character: CharacterController;

function Start(){
	character = GetComponent(CharacterController);
	raypoint = transform.position;
}

function Update(){
    if(Input.GetButton("Fire1")){
		var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
		if(Physics.Raycast(ray, hit))
		{
			raypoint = hit.point;
		}
	}
	var dir = raypoint - transform.position;
	dir.y = -gravity;  // applies a fake gravity
	character.Move(dir * Time.deltaTime * speed);
}