百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

avian

> 编程语言
开源

适用于 Bevy 游戏引擎的由 ECS 控制的 2D 和 3D 物理引擎。

3.1K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

适用于 Bevy 游戏引擎的由 ECS 控制的 2D 和 3D 物理引擎。

Avian is an ECS-driven 2D and 3D physics engine for the Bevy game engine.


Design

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.
  • Utilize the ECS as much as possible. The engine should feel like a part of Bevy, and it shouldn't need to maintain a separate physics world.
  • Use a highly modular plugin architecture. Users should be able to replace parts of the engine with their own implementations.
  • Have good documentation. A physics engine is pointless if you don't know how to use it.

Features

Below are some of the current features of Avian.

  • Dynamic, kinematic and static rigid bodies
    • Linear and angular velocity
    • External forces, torque and impulses
    • Gravity and gravity scale
    • 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
    • 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 collision hooks
    • Manual contact queries and intersection tests
  • Constraints and joints
    • Several built-in joint types: fixed, distance, prismatic, revolute, spherical
    • 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
    • Flexible SpatialQuery system parameter
    • Spatial query filters
  • Transform interpolation and extrapolation for fixed timesteps
  • Debug rendering for colliders, AABBs, contacts, joints, spatial queries, and more
  • Configurable scheduling and high customizability
  • Highly modular plugin architecture, freely extend and replace parts of the engine
  • Support for custom collision backends
  • f32/f64 precision (f32 by default)

You can find a more complete list along with documentation in the Table of Contents on docs.rs.

Documentation

  • 2D documentation
  • 3D documentation

Usage Example

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

# For 2D applications:
[dependencies]
avian2d = "0.7"

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

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

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 example.

…

More Examples

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

The examples support both f32 and f64 precisions, so the code contains some feature-dependent types like Real and RVector. In actual usage these are not needed, so you can just use f32 or f64 types depending on the features you have chosen.

By default the examples use f32. To run the f64 versions, you need to disable default features and manually choose the dimension and precision:

# Manually specify dimension and precision. `parry-f64` enables collision detection using Parry.
cargo run --example cubes --no-default-features --features "3d f64 parry-f64"

Version Table

Bevy Avian
0.19 0.7
0.18 0.5-0.6
0.17 0.4
0.16 0.3
0.15 0.2
0.14 0.1

Avian provides migration guides for each version.

Bevy XPBD versions (the predecessor of Avian)
Bevy Bevy XPBD
0.14 0.5
0.13 0.4
0.12 0.3
0.11 0.2
0.10 0.1

Contributing

If you encounter any problems, feel free to open issues or create pull requests. For larger changes and additions, it's better to open an issue or ask me for input before making a pull request. Make sure to review our AI policy before contributing.

We also have our own Avian Dev Discord server for development discussions related to Avian or other physics topics. Hop in if you want to chat or follow along!

For other guidance or questions, consider joining us on the Bevy Discord server's Avian Physics topic in #ecosystem-crates. My username on the Discord is Jondolf (@jondolfdev).

Acknowledgements

Huge thanks to the entire Bevy community for the incredible support! All of your contributions, insight and requests are a massive help in driving the state of physics in Bevy forward, and it's what keeps me motivated to build the best engine I can.

I would also like to give a special thanks to Johan Helsing for inspiring this project and helping me significantly in the early stages. His original tutorial series 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.

License

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

  • MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
  • Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)

at your option.

Issues· 204 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rust2d3dbevygame-development

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言