This simulation shows you how to simulate dc motor and magnet.
In DC motor and magnet simulation, red vectors represent current, green vectors indicate magnetic field direction, and magenta vectors represent force.
If you want to fix a magnet or coil. Make it static in its rigidbody.
If you don't want to see the vectors, turn off the draw command in ErayDraw. This improves performance.
The strength of the magnetic field depends on the current flowing. For this reason, if you want to increase the strength. Change the currentmultiplier variable in CurrentAdder and start the simulation again. If you don't want to reboot. Find the correct current in the ForceCalculator and change the currentmultiplier variable.
New motor designs such as BLDC will come.