move back character

Hello! I have walls around scene. Each has triger . When character controller entering triger, it must be moved back for some distance.

void OnTriggerEnter(Collider other)

        if(other.gameObject.tag == "Mine")

            var direction = other.gameObject.transform.position;

            direction.z = this.transform.position.z - OffsetZ;

            controlMode.PointToGo = direction;



This code works but use one axis. I think to use normalized vector of wall?

You could use Collider.Raycast to get the normal vector at the collision point. Something like the following:

var ray = new Ray(transform.position, transform.forward);
var hitInfo = new RaycastHit();
other.Raycast(ray, out hitInfo, 100.0f)
// hitInfo.normal will have the normal.