Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
49 changes: 21 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,26 @@ Below are some of the current features of Avian.
- `f32`/`f64` precision (`f32` by default)

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

## Documentation

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

## Usage example
## Usage Example

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

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

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

# If you want to use the most up-to-date version, you can follow the main branch:
[dependencies]
Expand Down Expand Up @@ -109,47 +109,40 @@ fn setup(
commands.spawn((
RigidBody::Static,
Collider::cylinder(4.0, 0.1),
PbrBundle {
mesh: meshes.add(Cylinder::new(4.0, 0.1)),
material: materials.add(Color::WHITE),
..default()
},
Mesh3d(meshes.add(Cylinder::new(4.0, 0.1))),
MeshMaterial3d(materials.add(Color::WHITE)),
));

// Dynamic physics object with a collision shape and initial angular velocity
commands.spawn((
RigidBody::Dynamic,
Collider::cuboid(1.0, 1.0, 1.0),
AngularVelocity(Vec3::new(2.5, 3.5, 1.5)),
PbrBundle {
mesh: meshes.add(Cuboid::from_length(1.0)),
material: materials.add(Color::srgb_u8(124, 144, 255)),
transform: Transform::from_xyz(0.0, 4.0, 0.0),
..default()
},
Mesh3d(meshes.add(Cuboid::from_length(1.0))),
MeshMaterial3d(materials.add(Color::srgb_u8(124, 144, 255))),
Transform::from_xyz(0.0, 4.0, 0.0),
));

// Light
commands.spawn(PointLightBundle {
point_light: PointLight {
commands.spawn((
PointLight {
shadows_enabled: true,
..default()
},
transform: Transform::from_xyz(4.0, 8.0, 4.0),
..default()
});
Transform::from_xyz(4.0, 8.0, 4.0),
));

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

![A spinning cube falling onto a circular platform](https://github.com/user-attachments/assets/14d25e7e-9d46-467c-9fe6-dc408cd23398)

## More examples
## More Examples

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

Expand All @@ -164,11 +157,11 @@ and precision:
cargo run --example cubes --no-default-features --features "3d f64 parry-f64"
```

## Supported Bevy versions
## Supported Bevy Versions

| Bevy | Avian |
| ------- | ----- |
| 0.15 | main |
| 0.15 | 0.2 |
| 0.14 | 0.1 |

<details>
Expand All @@ -184,7 +177,7 @@ cargo run --example cubes --no-default-features --features "3d f64 parry-f64"

</details>

## Future features
## Future Features

- Per-entity collision hooks or callbacks
- Flags for what types of collisions are active, like collisions against specific rigid body types, sensors or parents
Expand Down
6 changes: 3 additions & 3 deletions crates/avian2d/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "avian2d"
version = "0.1.2"
version = "0.2.0"
edition = "2021"
license = "MIT OR Apache-2.0"
authors = ["Joona Aalto <[email protected]>"]
Expand Down Expand Up @@ -61,7 +61,7 @@ required-features = ["2d"]
bench = false

[dependencies]
avian_derive = { path = "../avian_derive", version = "0.1" }
avian_derive = { path = "../avian_derive", version = "0.2" }
bevy = { version = "0.15", default-features = false }
bevy_math = { version = "0.15" }
bevy_heavy = { version = "0.1" }
Expand All @@ -86,7 +86,7 @@ glam = { version = "0.29", features = ["bytemuck"] }
approx = "0.5"
bytemuck = "1.19"
criterion = { version = "0.5", features = ["html_reports"] }
bevy_mod_debugdump = { git = "https://github.com/jakobhellermann/bevy_mod_debugdump" }
bevy_mod_debugdump = { version = "0.12" }

[[example]]
name = "dynamic_character_2d"
Expand Down
2 changes: 1 addition & 1 deletion crates/avian2d/examples/custom_collider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn main() {
.insert_resource(Gravity::ZERO)
.add_systems(Startup, setup)
.add_systems(
PhysicsSchedule,
FixedUpdate,
(center_gravity, rotate).in_set(PhysicsStepSet::First),
)
.run();
Expand Down
6 changes: 3 additions & 3 deletions crates/avian3d/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "avian3d"
version = "0.1.2"
version = "0.2.0"
edition = "2021"
license = "MIT OR Apache-2.0"
authors = ["Joona Aalto <[email protected]>"]
Expand Down Expand Up @@ -63,7 +63,7 @@ required-features = ["3d"]
bench = false

[dependencies]
avian_derive = { path = "../avian_derive", version = "0.1" }
avian_derive = { path = "../avian_derive", version = "0.2" }
bevy = { version = "0.15", default-features = false }
bevy_math = { version = "0.15" }
bevy_heavy = { version = "0.1" }
Expand All @@ -90,7 +90,7 @@ bevy_math = { version = "0.15", features = ["approx"] }
bevy_heavy = { version = "0.1", features = ["approx"] }
approx = "0.5"
criterion = { version = "0.5", features = ["html_reports"] }
bevy_mod_debugdump = { git = "https://github.com/jakobhellermann/bevy_mod_debugdump" }
bevy_mod_debugdump = { version = "0.12" }

[[example]]
name = "dynamic_character_3d"
Expand Down
4 changes: 2 additions & 2 deletions crates/avian_derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "avian_derive"
version = "0.1.0"
version = "0.2.0"
edition = "2021"
license = "MIT OR Apache-2.0"
authors = ["Joona Aalto <[email protected]>"]
description = "Provides derive implementations for Avian"
description = "Provides derive implementations for Avian Physics"
repository = "https://github.com/Jondolf/avian"
readme = "README.md"

Expand Down
2 changes: 1 addition & 1 deletion crates/avian_derive/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Provides derive implementations for Avian.
//! Provides derive implementations for [Avian Physics](https://github.com/Jondolf/avian).

use proc_macro::TokenStream;

Expand Down
Loading
Loading