any idea??

hi all, i am building a simple script, whenever the user went pass a cube, it will trigger a gui, and the user will stop walking. wad approach i should go in scripting ? isit by using waypoint? a little confused here. thanks alot.

You should use a collider and set it to trigger. In the player script, use:

function OnTriggerEnter (other : Collider) {
  //check to see if you this is the collider you are looking for
}

kk thanks, i have successfully used the colliders, by the way i just apply the waypoint codes to my gameobject, but it keep pop out the error message of :

IndexOutOfRangeException: Array index is out of range.
(wrapper stelemref) System.Object:stelemref (object,intptr,object)
waypoint.Awake () (at Assets\waypoint.js:7)

var waypoint : Transform[ ];
var speed : float = 20;
private var currentWaypoint : int;
var loop : boolean = true;

function Awake(){
waypoint[0] = transform;
}

function Update (){
if(currentWaypoint < waypoint.length){
var target : Vector3 = waypoint[currentWaypoint].position;
var moveDirection : Vector3 = target - transform.position;

var velocity = rigidbody.velocity;
if(moveDirection.magnitude < 1){
currentWaypoint++;
}
else{
velocity = moveDirection.normalized * speed;
}
}
else{
if(loop){
currentWaypoint=0;
}
else{
velocity = Vector3.zero;
}
}

rigidbody.velocity = velocity;
transform.LookAt(target);
}

Any idea know why? do i need to amend my resolution, setting or size, etc to fit the range?

I haven’t looked at the whole code, but th error you are getting is because you did not set the array size in memory before using it. (These are fixed size arrays)

Try:

waypoint = new Transform[10];