TheNumber5 / lorentz-force-unity

A method for simulating the Lorentz Force on charged particles in Unity.

Repository from Github https://github.comTheNumber5/lorentz-force-unityRepository from Github https://github.comTheNumber5/lorentz-force-unity

Description

A method for simulating the Lorentz Force on charged particles in Unity.

The Lorentz Force is a well-known force in physics, it shows that if a charged particle is in a electric field it will move, and if the particle is in a magnetic field its trajectory will be changed.

Eqn

This project simulates a simple case of the Lorentz Force in Unity, where the electric field is always in the Vector3.forward direction and the magnetic field is always in the y direction, or up.

The Sample Scene.unitypackage file, when imported to any Unity version after and including 2020.1.9f1, will show an example as viewed in the videos category. Each particle must have the LorentzForceParticle.cs script attached to it. A game object that will be the simulation manager in this case needs to be created, where the ParticleManager.cs and the LorentzParticleOscillator.cs scripts need to be attached.

Videos

V1.mp4
V2.mp4
V3.mp4
V4.mp4

This effect can be made by setting the XM, ZM, YE and ZE values of the particle to 1.

About

A method for simulating the Lorentz Force on charged particles in Unity.

License:Creative Commons Zero v1.0 Universal


Languages

Language:C# 100.0%