Skip to content

OVPavlov/unit-generator

Repository files navigation

Unit Generator

Generates physics metric units, and performs compile time dimensional analysis

Compile time dimensional analysis:

Now you don't need to worry about messing up your physics equations

How it works:

you configure the generator and it generates all the units and operations with dimensional analysis already done.

public static N operator /(W power, mps speed) => new N(power.f / speed.f);

Bonus feature - Units in your editor:

Don't worry all the conversions happen in editor.

You can configure whatewer units you want in your editor.

Supports All the physics units: s, kg, m, A, K, mol, cd;

Bonus unit: rad for more efficien conversion from deg to rad in editor.

How to use:

  1. Create UnitGenerator ScriptableObject in a directory where you want to generate the units code.
    1. Alternatively you can Copy Packages/com.ovpavlov.unitgenerator/Editor/UnitGeneratorExample.asset for preconfigured generator example
  2. Toggle 'Dry Run' and then press 'Generate Button'(which in fact is a Button that looks like a toggle), and check Console to see diagnostics.
  3. Untoggle 'Dry Run' and then press 'Generate Button' to generate the code

About

No description or website provided.

Topics

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta

Stars

Watchers

Forks

Contributors

Languages