Problem with Vector3.Reflect

Hi
Im trying to simulate a ball bouncing on a wall with Vector3.Reflect

void Start () {
	speed = 4;
	direction = Vector3.forward * Time.deltaTime * speed;
}

void Update () {
	transform.Translate(direction);
}

void OnTriggerEnter (Collider col) {
	if(col.name == "Wall"){
		 direction = Vector3.Reflect(direction, col.transform.right);
	}
}

My problem is the ball is bouncing back the same direction it came like not with a reflective angle.
Im putting an image with the normal of the wall and the world space

alt text

You’re mixing local space (the direction vector) with world space (the wall normal). It would be better to work in world space, using transform.forward instead of Vector3.forward, and specifying Space.World in Translate (the default is Space.Self). Another point: you should move the multiplication by Time.deltaTime from Start to Update (this value changes each frame):

void Start () {
    speed = 4;
    // transform.forward is the local forward in world space
    direction = transform.forward * speed;
}

void Update () {
    // translate in the world space:
    transform.Translate(direction * Time.deltaTime, Space.World);
}

void OnTriggerEnter (Collider col) {
    if(col.name == "Wall"){
        direction = Vector3.Reflect(direction, Vector3.right);
    }
}

NOTE: Translate doesn’t check collisions. If you have a rigidbody in the trigger or in the moving object, this may even work - but a better, easier and more precise solution would be to use a moving rigidbody (with useGravity = false) and let the collision system do the job for you. You could set Freeze Y under Rigidbody/Constraints in the Inspector to avoid movement in the Y axis, and let Physx do the rest.