Orient object on uneven surface

I have an animated locator where it is moving along an uneven surface.
However its axis/ rotational channels are not conforming to the uneven surface.

Is there a tool or script that allows me to make this animated locator to be align/ orient on the surface it is moving?

Yesterday, I learned how to use a 4x4 matrix + pointOnSurfaceInfo node. It might help you.

I included a script in this thread. But https://bindpose.com/maya-matrix-nodes-part-3-matrix-rivet/ talks a lot more about it.