Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebrand to Avian #397

Merged
merged 33 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5081acf
Rework module structure, and improve documentation and `Rotation` (#370)
Jondolf Jun 14, 2024
949e42a
Rename to Avian
Jondolf Jun 14, 2024
75b3607
Add icon
Jondolf Jun 26, 2024
52431d6
Simplify icon
Jondolf Jun 26, 2024
d4ed103
Update versioning to 0.1.0
Jondolf Jun 26, 2024
ab78ce6
Use RC version of Bevy
Jondolf Jun 27, 2024
c7f84c1
Merge branch 'main' into avian
Jondolf Jun 30, 2024
8cd86d6
Merge changes to avian branch
Jondolf Jun 30, 2024
666c458
Update snapshots and fix test
Jondolf Jun 30, 2024
1b59fac
Rework contact solver and collision detection, implement speculative …
Jondolf Jul 1, 2024
9e8512f
Clean up and refactor joint logic (#390)
Jondolf Jul 1, 2024
78ab7bf
Fix `GlobalTransform` updates for entities that have non-physics chil…
Jondolf Jul 2, 2024
4d682d7
Merge branch 'fix-transform-update-bug' into avian
Jondolf Jul 2, 2024
3bb6b42
Implement sweep-based CCD (#391)
Jondolf Jul 2, 2024
ffb4ba9
Update icon and logo
Jondolf Jul 2, 2024
c3b4c09
Update crate-level docs
Jondolf Jul 2, 2024
05a8f90
Update README
Jondolf Jul 2, 2024
9154591
Fix inconsistency between colliders and Bevy's primitives (#394)
Jondolf Jul 3, 2024
f231f86
Update code exmple in README
Jondolf Jul 3, 2024
a3d5efc
Fix link
Jondolf Jul 3, 2024
b86e597
Improve docs
Jondolf Jul 3, 2024
c2a2ab3
Implement collision margin (#393)
Jondolf Jul 3, 2024
ff667bb
Merge branch 'avian' of https://github.com/Jondolf/bevy_xpbd into avian
Jondolf Jul 3, 2024
fe82920
Mention `CollisionMargin` in `Collider` docs
Jondolf Jul 3, 2024
f615d40
Register and reflect more types
Jondolf Jul 3, 2024
cb920f1
Add `#[reflect(Serialize, Deserialize)]` and register more types (#395)
Jondolf Jul 3, 2024
ee82dec
Remove duplicated word
Jondolf Jul 3, 2024
e8425fc
Remove methods deprecated in 0.4
Jondolf Jul 3, 2024
afe07a2
Fix doc example formatting
Jondolf Jul 4, 2024
85b40f1
Use `Rotation::degrees` instead of `from_degrees` in docs
Jondolf Jul 4, 2024
80db8a5
Fix speculative collision code example comment
Jondolf Jul 5, 2024
39eb23c
Merge branch 'main' into avian
Jondolf Jul 5, 2024
48cff7b
Fix doc examples
Jondolf Jul 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Run cargo test
run: cargo test --no-default-features --features enhanced-determinism,collider-from-mesh,serialize,bevy_xpbd_2d/2d,bevy_xpbd_3d/3d,bevy_xpbd_2d/f64,bevy_xpbd_3d/f64,default-collider,parry-f64,bevy_scene
run: cargo test --no-default-features --features enhanced-determinism,collider-from-mesh,serialize,avian2d/2d,avian3d/3d,avian2d/f64,avian3d/f64,default-collider,parry-f64,bevy_scene

lints:
name: Lints
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["crates/bevy_xpbd_2d", "crates/bevy_xpbd_3d"]
members = ["crates/avian2d", "crates/avian3d"]
resolver = "2"

[profile.dev]
Expand Down
107 changes: 53 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
# Bevy XPBD (soon deprecated in favor of [Avian](https://github.com/Jondolf/avian))
# ![Avian Physics](https://raw.githubusercontent.com/Jondolf/bevy_xpbd/avian/assets/branding/logo.svg)

[![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)](https://github.com/Jondolf/bevy_xpbd#license)
[![ci](https://github.com/Jondolf/bevy_xpbd/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/Jondolf/bevy_xpbd/actions/workflows/ci.yml)
[![2D crates.io](https://img.shields.io/crates/v/bevy_xpbd_2d?label=2D%20crates.io)](https://crates.io/crates/bevy_xpbd_2d)
[![2D docs.rs](https://img.shields.io/docsrs/bevy_xpbd_2d?label=2D%20docs.rs)](https://docs.rs/bevy_xpbd_2d)
[![3D crates.io](https://img.shields.io/crates/v/bevy_xpbd_3d?label=3D%20crates.io)](https://crates.io/crates/bevy_xpbd_3d)
[![3D docs.rs](https://img.shields.io/docsrs/bevy_xpbd_3d?label=3D%20docs.rs)](https://docs.rs/bevy_xpbd_3d)
[![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)](https://github.com/Jondolf/avian#license)
[![ci](https://github.com/Jondolf/avian/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/Jondolf/avian/actions/workflows/ci.yml)
[![2D crates.io](https://img.shields.io/crates/v/avian2d?label=2D%20crates.io)](https://crates.io/crates/avian2d)
[![2D docs.rs](https://img.shields.io/docsrs/avian2d?label=2D%20docs.rs)](https://docs.rs/avian2d)
[![3D crates.io](https://img.shields.io/crates/v/avian3d?label=3D%20crates.io)](https://crates.io/crates/avian3d)
[![3D docs.rs](https://img.shields.io/docsrs/avian3d?label=3D%20docs.rs)](https://docs.rs/avian3d)

**⚠️ Bevy XPBD will be deprecated in favor of its successor [Avian](https://github.com/Jondolf/avian) (releases today or tomorrow).
No further development or maintenance will be done for Bevy XPBD.
See [#346](https://github.com/Jondolf/bevy_xpbd/issues/346) for background.**

---

**Bevy XPBD** is a 2D and 3D physics engine based on _Extended Position Based Dynamics_ (XPBD)
for the [Bevy game engine](https://bevyengine.org/).
**Avian** is an ECS-based 2D and 3D physics engine for the [Bevy game engine](https://bevyengine.org/).

---

## Design

Below are some of the core design principles used in Bevy XPBD.
Below are some of the core design principles used in Avian.

- **Made with Bevy, for Bevy.** No wrappers around existing engines.
- **Provide an ergonomic and familiar API.** Ergonomics is key for a good experience.
Expand All @@ -32,7 +25,7 @@ Below are some of the core design principles used in Bevy XPBD.

## Features

Below are some of the current features of Bevy XPBD.
Below are some of the current features of Avian.

- Dynamic, kinematic and static rigid bodies
- Linear and angular velocity
Expand All @@ -41,17 +34,18 @@ Below are some of the current features of Bevy XPBD.
- Linear and angular damping
- Locking translational and rotational axes
- Rigid body dominance
- Continuous Collision Detection (CCD)
- Automatic deactivation with sleeping
- Collision detection powered by [Parry](https://parry.rs)
- Colliders with configurable collision layers, density, material properties and more
- Collider generation for meshes and entire scenes
- Collision events
- Access to colliding entities
- Filtering and modifying collisions with custom systems
- Manual contact queries and intersection tests
- Constraints and joints
- Flexible API for creating position-based constraints
- Several built-in joint types: fixed, distance, prismatic, revolute, spherical
- Support for custom joints and other constraints
- Support for custom joints and other constraints using XPBD
- Spatial queries
- Raycasting, shapecasting, point projection and intersection tests
- Ergonomic component-based API for raycasts and shapecasts
Expand All @@ -64,40 +58,42 @@ Below are some of the current features of Bevy XPBD.
- `f32`/`f64` precision (`f32` by default)

You can find a more complete list along with documentation in the
[Table of contents](https://docs.rs/bevy_xpbd_3d/latest/bevy_xpbd_3d/#table-of-contents)
[Table of contents](https://docs.rs/avian3d/latest/avian3d/#table-of-contents)
on docs.rs.

## Documentation

- [2D documentation](https://docs.rs/bevy_xpbd_2d)
- [3D documentation](https://docs.rs/bevy_xpbd_3d)
- [2D documentation](https://docs.rs/avian2d)
- [3D documentation](https://docs.rs/avian3d)

## Usage example

First, add `bevy_xpbd_2d` or `bevy_xpbd_3d` to your dependencies in `Cargo.toml`:
First, add `avian2d` or `avian3d` to your dependencies in `Cargo.toml`:

```toml
# For 2D applications:
[dependencies]
bevy_xpbd_2d = "0.5"
avian2d = "0.1"

# For 3D applications:
[dependencies]
bevy_xpbd_3d = "0.5"
avian3d = "0.1"

# If you want to use the most up-to-date version, you can follow the main branch:
[dependencies]
bevy_xpbd_3d = { git = "https://github.com/Jondolf/bevy_xpbd", branch = "main" }
avian3d = { git = "https://github.com/Jondolf/avian", branch = "main" }
```

Below is a very simple example where a box with initial angular velocity falls onto a plane. This is a modified version of Bevy's [3d_scene](https://bevyengine.org/examples/3d/3d-scene/) example.
Below is a very simple example where a cube with initial angular velocity falls onto a circular platform.
This is a modified version of Bevy's [`3d_scene`](https://bevyengine.org/examples/3D%20Rendering/3d-scene/) example.

```rust
use avian3d::prelude::*;
use bevy::prelude::*;
use bevy_xpbd_3d::prelude::*;

fn main() {
App::new()
// Enable physics
.add_plugins((DefaultPlugins, PhysicsPlugins::default()))
.add_systems(Startup, setup)
.run();
Expand All @@ -108,25 +104,25 @@ fn setup(
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
) {
// Plane
// Static physics object with a collision shape
commands.spawn((
RigidBody::Static,
Collider::cuboid(8.0, 0.002, 8.0),
Collider::cylinder(4.0, 0.1),
PbrBundle {
mesh: meshes.add(Plane3d::default().mesh().size(8.0, 8.0)),
material: materials.add(Color::srgb(0.3, 0.5, 0.3)),
mesh: meshes.add(Cylinder::new(4.0, 0.1)),
material: materials.add(Color::WHITE),
..default()
},
));

// Cube
// Dynamic physics object with a collision shape and initial angular velocity
commands.spawn((
RigidBody::Dynamic,
AngularVelocity(Vec3::new(2.5, 3.4, 1.6)),
Collider::cuboid(1.0, 1.0, 1.0),
AngularVelocity(Vec3::new(2.5, 3.5, 1.5)),
PbrBundle {
mesh: meshes.add(Cuboid::default()),
material: materials.add(Color::srgb(0.8, 0.7, 0.6)),
mesh: meshes.add(Cuboid::new(1.0, 1.0, 1.0)),
material: materials.add(Color::srgb_u8(124, 144, 255)),
transform: Transform::from_xyz(0.0, 4.0, 0.0),
..default()
},
Expand All @@ -135,7 +131,6 @@ fn setup(
// Light
commands.spawn(PointLightBundle {
point_light: PointLight {
intensity: 2_000_000.0,
shadows_enabled: true,
..default()
},
Expand All @@ -145,17 +140,17 @@ fn setup(

// Camera
commands.spawn(Camera3dBundle {
transform: Transform::from_xyz(-4.0, 6.5, 8.0).looking_at(Vec3::ZERO, Vec3::Y),
transform: Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Dir3::Y),
..default()
});
}
```

<https://user-images.githubusercontent.com/57632562/230185604-b40441a2-48d8-4566-9b9e-be4825f4877e.mp4>
![A spinning cube falling onto a circular platform](https://github.com/Jondolf/bevy_xpbd/assets/57632562/d53197fc-e142-4eb9-a762-dc16f6cdb1dd)

## More examples

You can find lots of 2D and 3D examples in [/crates/bevy_xpbd_2d/examples](/crates/bevy_xpbd_2d/examples) and [/crates/bevy_xpbd_3d/examples](/crates/bevy_xpbd_3d/examples) respectively.
You can find lots of 2D and 3D examples in [/crates/avian2d/examples](/crates/avian2d/examples) and [/crates/avian3d/examples](/crates/avian3d/examples) respectively.

The examples support both `f32` and `f64` precisions, so the code contains some feature-dependent types like `Scalar` and `Vector`.
In actual usage these are not needed, so you can just use `f32` or `f64` types depending on the features you have chosen.
Expand All @@ -170,23 +165,27 @@ cargo run --example cubes --no-default-features --features "3d f64 parry-f64"

## Supported Bevy versions

**Note**: Bevy XPBD is deprecated and won't support future versions of Bevy.
Instead, it is recommended to use its successor [Avian](https://github.com/Jondolf/avian).
| Bevy | Avian |
| ---- | ----- |
| 0.14 | 0.1 |

<details>
<summary>Bevy XPBD versions (the predecessor of Avian)</summary>

| Bevy | Bevy XPBD |
| ---- | --------- |
| 0.14 | 0.5 |
| 0.13 | 0.4 |
| 0.12 | 0.3 |
| 0.11 | 0.2 |
| 0.10 | 0.1 |
| Bevy | Bevy XPBD |
| ---- | --------- |
| 0.14 | 0.5 |
| 0.13 | 0.4 |
| 0.12 | 0.3 |
| 0.11 | 0.2 |
| 0.10 | 0.1 |
</details>

## Future features

- Continuous collision detection (CCD)
- Per-entity collision hooks or callbacks
- Flags for what types of collisions are active, like collisions against specific rigid body types, sensors or parents
- Performance optimization (better broad phase, parallel solver...)
- Performance optimization (better broad phase, parallel solver, proper SIMD...)
- Joint motors
- Articulations, aka. multibody joints
- Proper cross-platform determinism
Expand All @@ -200,7 +199,7 @@ For larger changes and additions, it's better to open an issue or ask me for inp
before making a pull request.

You can also ask for help or ask questions on the [Bevy Discord](https://discord.com/invite/gMUk5Ph)
server's `bevy_xpbd` thread in `#crate-help`. My username on the Discord is `Jondolf` (`@jondolfdev`).
server's `avian` thread in `#crate-help`. My username on the Discord is `Jondolf` (`@jondolfdev`).

## Acknowledgements

Expand All @@ -211,7 +210,7 @@ keeps me motivated to build the best engine I can.

I would also like to give a special thanks to [Johan Helsing][johan-helsing]
for inspiring this project and helping me significantly in the early stages.
His original [tutorial series][johan-xpbd-tutorial] is the reason `bevy_xpbd`
His original [tutorial series][johan-xpbd-tutorial] is the reason `avian`
exists in the first place, and without his support and contributions,
the project wouldn't be anywhere near where it is today.

Expand All @@ -220,7 +219,7 @@ the project wouldn't be anywhere near where it is today.

## License

Bevy XPBD is free and open source. All code in this repository is dual-licensed under either:
Avian is free and open source. All code in this repository is dual-licensed under either:

- MIT License ([LICENSE-MIT](/LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
- Apache License, Version 2.0 ([LICENSE-APACHE](/LICENSE-APACHE) or <http://www.apache.org/licenses/LICENSE-2.0>)
Expand Down
Binary file added assets/branding/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading