How to constrain an object's motion with the Simple Motion Actuator
Constraints in game engine are defined using logic bricks or Python.

See the example file using the Constraint actuator: http://pasteall.org/blend/index.php?id=48429

BGE Manual: https://docs.blender.org/manual/en/dev/game_engine/logic/actuators/types/constraint.html#location-constraint