1 unstable release
Uses new Rust 2024
new 0.0.1 | Mar 21, 2025 |
---|
#6 in #rigid-body-simulation
101 downloads per month
32KB
Bevy Newton - Newtonian Physics for Bevy
A feature-rich Newtonian physics engine natively integrated with the Bevy game engine.
Features
- 🚀 Rigid Body Dynamics
- Linear & angular velocity integration
- Mass properties and inertia tensors
- Force/torque accumulation
- 🔥 Collision Detection
- Sphere, Box, Capsule, and Convex Hull primitives
- Broad-phase spatial partitioning
- Narrow-phase SAT (Separating Axis Theorem)
- ⚡ Collision Resolution
- Impulse-based contact resolution
- Restitution (bounciness) and friction
- Collision events and queries
- 🧠 Advanced Features
- Continuous collision detection
- Raycasting and shape queries
- Joint constraints (ball, hinge, prismatic)
- Force fields and area effects
Installation
Add to your Cargo.toml
:
[dependencies]
bevy_newton = "0.1"
Basic Usage
use bevy::prelude::*;
use bevy_newton::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(PhysicsPlugin::default())
.add_systems(Startup, setup)
.run();
}
Feature Flags
Feature | Description | Default |
---|---|---|
3d |
Enable 3D physics | Yes |
2d |
Simplified 2D physics | Yes |
collision |
Advanced collision features | Yes |
debug |
Visualization tools | No |
serialize |
Component serialization | No |
Performance
Benchmarks (Intel i9-13900K @ 5.8GHz):
Scenario | Entities | Time/Frame |
---|---|---|
Simple Collision | 1,000 | 0.8ms |
Complex Constraints | 500 | 1.2ms |
Raycasting (100 rays) | - | 0.3ms |
Documentation
Contributing
We welcome contributions! Please see our Contribution Guide for details.
License
Dual-licensed under either:
- MIT License (LICENSE-MIT)
- Apache License, Version 2.0 (LICENSE-APACHE)
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual-licensed as above, without any additional terms or conditions.
Dependencies
~25–35MB
~583K SLoC