Triggering movement

Hello, I’m trying to get an object to move from one waypoint to another when my character enters a “trigger” any idea on how to set that up?

Make an object with a collider on it, and choose the collider to be a trigger. Make a new tag, and name it whatever you want.

In your code:

var tagName : String; //Set in inspector, matches the tag you made for the trigger object

function OnTriggerEnter(collisionInfo : Collider) {
    if(collisionInfo.gameObject.tag == tagName) {
    	//Trigger function
    }  
}

So I apply this script to the object, but where do I set the waypoints in the script? This is the script I use to move platforms:

var targetA : GameObject;
var targetB : GameObject;

var speed : float = 0.1;

function FixedUpdate () {
	var weight = Mathf.Cos(Time.time * speed * 2 * Mathf.PI) * 0.5 + 0.5;
	transform.position = targetA.transform.position * weight
						+ targetB.transform.position * (1-weight);
}

I tried it and it didn’t work, so I edited it little and it still didn’t work, here’s the code:

var targetA : GameObject;
var targetB : GameObject;

var speed : float = 0.1;

var tagName ; singlemove; //Set in inspector, matches the tag you made for the trigger object
 
function OnTriggerEnter(collisionInfo : Collider) {

    if(collisionInfo.gameObject.tag == tagName) {
var weight = Mathf.Cos(Time.time * speed * 2 * Mathf.PI) * 0.5 + 0.5;
	transform.position = targetA.transform.position * weight
						+ targetB.transform.position * (1-weight);

}  
}

I still can’t figure out what’s wrong with it.