I got an idea for this but do not know how to implement it or is it already made. The idea goes as - We take a circular container which is having 3 magnets at 120 degrees which can be pushed inside and outside the container at regular periods of time. Now we take a bar magnet fixed at the center of the container. Now if we push one of the bar magnet inside then the bar magnet would orient towards it by rotation. If we now pull the magnet and push another magnet then the bar magnet would again experience a torque and again rotate to orient itself towards the magnet. This we we can use the bar magnet as a shaft and use the system as a motor.
This was the idea. Can you all please tell me how to implement, improve the idea.