How to teleport a character to a given position?

I’m creating a real-time tour simulation. And would like the first person controller to teleport to a new position on contact with certain "Gate"s.
However I found that the normally used transform.position=(x,x,x) doesn’t work.

I tried controller=GetComponent(CharacterController) and then use controller.Move(), this works fine but can only transport the character for a certain distance(i.e. only relative position), but wouldn’t go to the absolute position with respect to the world as I expect. Moreover, this Move() function is also affected by the character’s speed.

I also tried something like:

var Position_elevator:Vector3=new Vector3(-110,0,20);

function OnControllerColliderHit (hit:ControllerColliderHit){

var transform_position:Vector3;



//or, //transform.position.Set(transform_position.x,transform_position.y,transform_position.z)
//which still doesn’t work…

Is there any good way to change the character’s position abruptly to a given position?
Thank you very much!

The below should work (as long as this is attached to your character controller), if it doesn’t tell me how it doesn’t work.

var Position_elevator : Vector3 = new Vector3(-110,0,20);

function OnControllerColliderHit (hit:ControllerColliderHit){
    if("Cube_CorridortoElevator") transform.position = Position_elevator;