Rotate an object along face normal in the bge
Set up the logic bricks as pictured above.

This script will move an object (the cone) to the location of ray.hitPosition and then rotate it to point along the ray.hitNormal using alignAxisToVect().
For this example, the cone is pointing along the positive z axis. If it was along a different axis, I would have to pass in the second parameter to alignAxisToVect().
import bge

cont = bge.logic.getCurrentController()
scene = bge.logic.getCurrentScene()

ray = cont.sensors[&quot;Ray&quot;]
cone = scene.objects[&quot;Cone&quot;]

if ray.hitObject and cone is not ray.hitObject:
    cone.worldPosition = ray.hitPosition
    cone.alignAxisToVect(ray.hitNormal)

Example gif, showing the cone moving and rotating to match the underlying geometry in the game engine.

Blend File