Escribe para buscar…

Avian

Esta página todavía no se ha traducido — se muestra en su idioma original:English

Introduction

Avian is an ECS-based 2D and 3D physics engine for Bevy, a refreshingly simple data-driven game engine built in Rust. Avian prioritizes ergonomics and modularity, with a focus on providing a native ECS-driven user experience.

Getting Started

Getting up to speed with Avian is very straightforward!

First, add it as a dependency in Cargo.toml:

yaml
[dependencies]
avian2d = "0.5" # For 2D applications
avian3d = "0.5" # For 3D applications
bevy = "0.18"

Then, add PhysicsPlugins to your Bevy application:

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

fn main() {
    App::new()
        .add_plugins((DefaultPlugins, PhysicsPlugins::default()))
        .run();
}

Now, you can use the numerous components and resources provided by Avian to add physics behavior to your entities.

For example, turning an entity into a rigid body with a collider is as simple as adding the RigidBody and Collider components, and an initial velocity can be specified using LinearVelocity:

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

fn setup(mut commands: Commands) {
    commands.spawn((
        RigidBody::Dynamic,
        Collider::sphere(0.5),
        LinearVelocity(Vec3::X),
    ));
}

Pending

https://joonaa.dev/blog/06/avian-0-1