Giving Digital Animations Real Life & Weight
Bake in natural cloth movement, fabric tears, crunching collisions, and dynamic deformation so web animations look fluid and physical instead of rigid and static.
git clone git@github.com:Aarav90-cpu/aPhysics.git
Cloth & Soft-Body Movement In Progress / Planned
Phase 2 native cloth is in progress (Steps 2.1โ2.3 complete); bending, colliders, and soft-body models remain Planned. See architecture.md.
Crash & Impact Mechanics Planned
Fracture, structural collapse, and particle deformation so collisions look impactful and lifelike.
Zero-Copy Three.js Memory Planned
Direct WebAssembly linear memory mapping with Float32Array views. Zero buffer duplication between C and JS.
Deterministic Seeds Planned
Deterministic Seeds: pass an explicit 64-bit seed (e.g. 1337ULL) for reproducible physics simulations across workers.
Clang 23 & Bazel 9
Built strictly with Clang 23 and Bazel 9 for reproducible builds and deterministic toolchain sandboxing.
Agent-Native Design
Strict rules in AGENTS.md with full compatibility for crawlers like fetchIt via sitemap.xml.
Engine Architecture
Planned memory sharing and determinism architecture, plus implemented Phase 1 core utilities.
1. Share Memory Directly with Three.js (Zero-Copy) Planned
Traditional bridges copy arrays between Wasm and JavaScript per frame, increasing copy work and Garbage Collection pressure on large meshes.
// 1. In C: Vertex buffer is contiguous in WebAssembly linear memory
// 2. In JavaScript: Wrap raw memory pointer with Float32Array (ZERO copies)
const positions = new Float32Array(
wasmMemory.buffer,
wasmInstance.exports.aphysics_get_positions(),
vertexCount * 3
);
// 3. Bind directly to Three.js BufferAttribute
geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3));
// 4. On each simulation step in C:
wasmInstance.exports.aphysics_step(dt);
geometry.attributes.position.needsUpdate = true; // WebGL streams directly to GPU VBO!
2. Deterministic Simulation via Seeds Planned
Remotion renders video frames concurrently across worker threads or cloud rendering containers. To keep simulation results consistent between machine A and machine B:
- Fixed Seed (
seed = 1337ULL): Designed so the internal PRNG produces repeatable perturbation values, folding angles, and tear thresholds per run. - Pure C Engine: The simulation core never queries system clocks or entropy. Callers or the JavaScript wrapper provide explicit seeds.
- Decoupled Fixed Delta Time (Δt): The solver advances on fixed intervals (e.g. 1/60s), avoiding frame-rate-dependent step divergence.
Looking for macOS Testers!
Help us test and expand aPhysics support on Apple Silicon and macOS Intel machines.
Why We Need Your Help
aPhysics is configured to compile with Clang 23 and Bazel 9 on macOS, but we need hardware testing to verify:
- Apple Silicon (M1/M2/M3/M4) compilation and floating-point determinism under Clang 23.
- macOS Command Line Tools and Xcode toolchain compatibility.
- Clean execution of
bazel test //...on Darwin kernels.
How You Can Test on macOS
# 1. Install Bazelisk
brew install bazelisk
# 2. Clone repository
git clone git@github.com:Aarav90-cpu/aPhysics.git
cd aPhysics
# 3. Build all targets
bazel build //...
# 4. Run tests
bazel test //...
# 5. Run executable
bazel run //tools:aphysics_info
Report any compiler warnings, build failures, or test results by opening an issue on GitHub:
Submit macOS Test ReportAgent Skills & Tooling
Autonomous AI guidelines and crawler compatibility.
Autonomous Agent Rules in AGENTS.md
This repository enforces strict operational guidelines for AI coding agents to guarantee code quality, reproducibility, and safety:
- Understand & Plan First: Agents must read code and present a detailed plan before making edits.
- Strict Tooling: Clang 23 only, Bazel 9 only. No GCC, no Makefiles.
- Mandatory Verification: Every change must be verified via Bazel build and tests, reporting exact commands and output.
- License Headers: Source files require Apache 2.0 headers applied through
addlicense.
Compatibility with fetchIt
The repository and website are specifically formatted to be indexed and downloaded cleanly by fetchIt, the documentation crawler and markdown exporter built by Aarav:
- The root
sitemap.xmlcontains the directive comment<!-- For FetchIt -->immediately below the XML declaration. - Semantic markdown structure allows
fetchItto strip noise and download complete, self-contained documentation sets.
Documentation Reader
Read repository documentation directly in this browser window.
About the Creator
Meet the developer behind aPhysics, ARK OS, and fetchIt.
Aarav (Arphd4)
"I build things because I can't help it: tools I wish existed, an operating system I probably have no business attempting, and songs that start as a half-formed idea at 2 a.m. Movies and music are a huge part of my life, and the rest is split between two obsessions: where AI is heading, and how interfaces should feel when it gets there."
Core Stack
Swift (home base for system-level programming), Kotlin (Android / Jetpack Compose UI experiments), C / C++, Python, and TypeScript.
Key Projects
libark, sash)
mido & DAW
Music & YouTube Channel
Aarav produces songs around tech, AI, and humanity. Check out tracks like BEYOND THE CODE, HUMAN BEHIND THE MACHINE, and One Bar of Wi-Fi: