how can i make my cube rotate when it touches a cube?,How to i make a object move when it touches a wall/object?

I am using rb.MovePosition

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class movement : MonoBehaviour
{
    public float forceMult = 200f;
    private Rigidbody rb;
    // Start is called before the first frame update
    void Awake()
    {
       rb = GetComponent<Rigidbody>();
      
    }

    // Update is called once per frame
    void Update()
    {
       rb.MovePosition(transform.position + (transform.forward * Time.deltaTime));
    }
}

,i am using rb.MovePosition to move my block

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class movement : MonoBehaviour
{
    public float forceMult = 200f;
    private Rigidbody rb;
    // Start is called before the first frame update
    void Awake()
    {
       rb = GetComponent<Rigidbody>();
      
    }

    // Update is called once per frame
    void Update()
    {
       rb.MovePosition(transform.position + (transform.forward * Time.deltaTime));
    }
}

Need to be a bit more specific on the question.

You could just add a physical material to the walls that is bouncy and then when the object collides with the wall it bounces off.

For the cube to rotate you can just make sure the rb doesn’t have any constraints on the proper axis and it should rotate when it comes in contact if enough force is added to the object. Or you can call your own method and say something like when cube collides with other objects add force in this direction.