https://github.com/juanperias/motion
Motion is a bare metal physics engine
https://github.com/juanperias/motion
bare-metal no-std physics rust
Last synced: 6 months ago
JSON representation
Motion is a bare metal physics engine
- Host: GitHub
- URL: https://github.com/juanperias/motion
- Owner: Juanperias
- License: apache-2.0
- Created: 2024-10-14T22:38:12.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-11-01T21:42:05.000Z (11 months ago)
- Last Synced: 2025-03-03T08:04:04.378Z (7 months ago)
- Topics: bare-metal, no-std, physics, rust
- Language: Rust
- Homepage: https://crates.io/crates/motion/
- Size: 101 KB
- Stars: 31
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Motion🍃
Motion is a **bare metal physics engine** with which you can make simulations easily and quickly, also in rust.
## Get started ✨
let's start by making a simple event loop
```rust
use std::{thread, time::Duration};use motion::event_loop::EventLoopBuilder;
// The definition of this function depends on the context in which motion is used
fn sleep(duration: Duration) {
thread::sleep(duration);
}fn main() {
let el = EventLoopBuilder::new().fps(1).build();el.start(|_config| println!("Hello! in the event loop"), sleep);
}
```now we are going to do something more complex by creating an object
```rust
let obj = Object2dBuilder::new()
.position(vec2(2.0, 2.0))
.density(2.0)
.mass(3.0)
.velocity(vec2(4.0, 4.0))
.acceleration(vec2(3.0, 3.0))
.radius(2.0)
.shape(Shape::Circle)
.build();
```## Why rust 🦀
Rust is a fast and efficient programming language, which makes it perfect for motion, plus it is very flexible allowing motion to be used everywhere.