if vector3 value = something

I have a box and a private Vector3 dir = new Vector3(1, 1, 0); attached to it, and when the box collides with a wall I want to check if dir=(1,1,0), if it is i want to change it to something else.

I hope you understood what I explained above, I am kinda noob in C# :slight_smile:

You want OnTriggerEnter

using UnityEngine;

public class Box : MonoBehaviour
{
    private Vector3 dir = new Vector3(1, 1, 0);

    private void Update()
    {
        transform.position += dir * Time.deltaTime * 2f;
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Wall")
            if (dir == new Vector3(1, 1, 0))
                dir = new Vector3(-1, -1, 0f);
    }
}

Make sure the box has a collider and rigidbody (checked kinematic) and the wall is tagged β€œWall” and has collider (checked trigger).