Unity and Unreal Engine plugin packages for MechanicsDSL — physically accurate simulation components compiled from DSL notation
Project description
mechanicsdsl-unity
Physically accurate simulation components for Unity and Unreal Engine, compiled from DSL notation.
Overview
mechanicsdsl-unity provides Unity MonoBehaviour components generated from MechanicsDSL DSL specifications. All components bypass PhysX with Lagrangian equations of motion, include Noether-based energy monitoring, and expose parameters in the Unity Inspector for real-time tuning.
Components
Classical Mechanics
| Component | System | Conserved | Gizmos |
|---|---|---|---|
PendulumComponent |
Simple pendulum | Energy (Noether) | Pivot, rod, bob |
DoublePendulumComponent |
Double pendulum (chaotic) | Energy (Noether) | Full double pendulum |
CoupledPendulumsComponent |
Coupled pendulums | Energy (Noether) | Both pendulums + spring |
Utilities
| Component | Description |
|---|---|
ConservationMonitor |
On-screen HUD for energy drift across any MechanicsDSL component |
PhaseSpaceTrail |
Renders θ vs ω phase portrait as a LineRenderer trail |
MechanicsDSLMath |
Generic RK4, symplectic Euler, angle wrap, bob position helpers |
Editor
| Script | Description |
|---|---|
PendulumComponentEditor |
Live state readout (θ, ω, t, E, |ΔE/E₀|) + Reset button |
DoublePendulumComponentEditor |
Dual-angle live readout + Reset button |
Repository Structure
mechanicsdsl-unity/
├── Runtime/
│ ├── Components/
│ │ ├── PendulumComponent.cs
│ │ ├── DoublePendulumComponent.cs
│ │ └── CoupledPendulumsComponent.cs
│ ├── Utilities/
│ │ ├── ConservationMonitor.cs
│ │ ├── PhaseSpaceTrail.cs
│ │ └── MechanicsDSLMath.cs
│ └── com.mechanicsdsl.unity.runtime.asmdef
├── Editor/
│ ├── PendulumComponentEditor.cs
│ ├── DoublePendulumComponentEditor.cs
│ └── com.mechanicsdsl.unity.editor.asmdef
├── Tests/Runtime/
│ ├── TestPendulumEOM.cs
│ ├── TestDoublePendulumEOM.cs
│ └── MechanicsDSL.Tests.Runtime.asmdef
├── Samples~/
│ ├── SimplePendulum/README.md
│ └── DoublePendulum/README.md
├── docs/
│ ├── getting_started.md
│ ├── components_reference.md
│ └── adding_systems.md
└── package.json (UPM manifest)
Installation
Via UPM (Unity Package Manager):
- Open Window → Package Manager
- Click + → Add package from git URL
- Enter:
https://github.com/MechanicsDSL/mechanicsdsl-unity.git
Quick Start
- Add MechanicsDSL → Classical → Pendulum to any GameObject
- Create a Sphere child and drag to Bob Transform
- Press Play — the sphere is driven by MechanicsDSL-generated Lagrangian equations
The Inspector shows live θ, ω, E, and |ΔE/E₀| during Play Mode. Click Reset to return to initial conditions without stopping.
Running Tests
Window → General → Test Runner → PlayMode → Run All
Tests cover energy conservation (5–10 s), reset/initial conditions, equilibrium stability, and bob Transform updates.
Generating New Components
pip install mechanicsdsl-core
mechanicsdsl generate my_system.msl --target unity --out Assets/Physics/
See docs/adding_systems.md for the full workflow.
Contributing
See CONTRIBUTING.md.
License
MIT License — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mechanicsdsl_unity-0.1.0.tar.gz.
File metadata
- Download URL: mechanicsdsl_unity-0.1.0.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bc099444b7d4154a5a211ca2674134aa758afece37612f7be485ba53dd9eec1
|
|
| MD5 |
3f0fd5b7462589bda8d257fd14941aac
|
|
| BLAKE2b-256 |
e9f11b281ea18dc623e7881a8274887d76a67ea80936d1653ea988586eceaf98
|
Provenance
The following attestation bundles were made for mechanicsdsl_unity-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on MechanicsDSL/mechanicsdsl-unity
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mechanicsdsl_unity-0.1.0.tar.gz -
Subject digest:
3bc099444b7d4154a5a211ca2674134aa758afece37612f7be485ba53dd9eec1 - Sigstore transparency entry: 1118500478
- Sigstore integration time:
-
Permalink:
MechanicsDSL/mechanicsdsl-unity@c2766da6300df9770da7519ba08f95697329afda -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/MechanicsDSL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@c2766da6300df9770da7519ba08f95697329afda -
Trigger Event:
push
-
Statement type:
File details
Details for the file mechanicsdsl_unity-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mechanicsdsl_unity-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53628c390765bc3d026aebc64f83eb75b3c28341406dad78b0c7eebee123d476
|
|
| MD5 |
f72b65cadc4ff3c1532306cd2c5a82ba
|
|
| BLAKE2b-256 |
25277d34090a2304d80c1dfd5b61bef2250a7a7f0c7bdbe6d17494adca24f943
|
Provenance
The following attestation bundles were made for mechanicsdsl_unity-0.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on MechanicsDSL/mechanicsdsl-unity
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mechanicsdsl_unity-0.1.0-py3-none-any.whl -
Subject digest:
53628c390765bc3d026aebc64f83eb75b3c28341406dad78b0c7eebee123d476 - Sigstore transparency entry: 1118500642
- Sigstore integration time:
-
Permalink:
MechanicsDSL/mechanicsdsl-unity@c2766da6300df9770da7519ba08f95697329afda -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/MechanicsDSL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@c2766da6300df9770da7519ba08f95697329afda -
Trigger Event:
push
-
Statement type: