### Bevy plugin for PhysX 5 [PhysX](https://github.com/NVIDIA-Omniverse/PhysX) is an open-source Physics SDK written in C++ and developed by Nvidia. \ This crate is a bridge between Bevy ECS and Rust [bindings](https://github.com/EmbarkStudios/physx-rs) made by Embark Studios. [github](https://github.com/rlidwka/bevy_mod_physx) [docs.rs](https://docs.rs/bevy_mod_physx) [crates.io](https://crates.io/crates/bevy_mod_physx) ### Getting started Here is a snippet, which creates a ball bouncing on a fixed ground. ```rust // this is similar to basic simulation example in rapier3d use bevy::prelude::*; use bevy_mod_physx::prelude::*; use bevy_mod_physx::prelude::{Material, Shape}; // bevy prelude conflicts fn main() { App::new() .add_plugins(DefaultPlugins) .add_plugins(PhysicsPlugins.set( PhysicsCore::new().with_pvd() )) .add_systems(Startup, setup_graphics) .add_systems(Startup, setup_physics) .insert_resource(DebugRenderSettings::enable()) .run(); } fn setup_graphics(mut commands: Commands) { // Add a camera so we can see the debug-render. commands.spawn(Camera3dBundle { transform: Transform::from_xyz(-3.0, 3.0, 10.0).looking_at(Vec3::ZERO, Vec3::Y), ..Default::default() }); } fn setup_physics( mut commands: Commands, mut physics: ResMut, mut geometries: ResMut>, mut materials: ResMut>, ) { // Create the ground. commands.spawn(( RigidBody::Static, Shape { geometry: geometries.add(Plane3d::default()), material: materials.add(Material::new(&mut physics, 0.5, 0.5, 0.6)), ..default() }, SpatialBundle::from_transform(Transform::from_xyz(0.0, -2.0, 0.0)), )); // Create the bouncing ball. commands.spawn(( RigidBody::Dynamic, Shape { geometry: geometries.add(Sphere::new(0.5)), material: materials.add(Material::new(&mut physics, 0.5, 0.5, 0.6)), ..default() }, SpatialBundle::from_transform(Transform::from_xyz(0.0, 4.0, 0.0)), )); } ``` ### Compatibility / Prior art |[]() |[]() |[]() |[]() | |---------------|--------------------------------------------------------------------------------------------------------|--------------|---------------| | published | [0.6.x](https://crates.io/crates/bevy_mod_physx) | Bevy 0.14 | PhysX 5 | | | [0.5.x](https://crates.io/crates/bevy_mod_physx) | Bevy 0.13 | PhysX 5 | | | [0.4.x](https://crates.io/crates/bevy_mod_physx) | Bevy 0.12 | PhysX 5 | | | [0.2.x - 0.3.x](https://crates.io/crates/bevy_mod_physx) | Bevy 0.11 | PhysX 5 | | | | | | | git tags | [git:a21b570](https://github.com/rlidwka/bevy_mod_physx/tree/a21b570b20a1e7ac22b5c86c54fcc1597760f2ec) | Bevy 0.11 | PhysX 4 | | (unpublished) | [git:43ae89e](https://github.com/rlidwka/bevy_mod_physx/tree/43ae89e013daf00ef841611149420fb4d04c2a4f) | Bevy 0.10 | PhysX 5 | | | [git:8f66a99](https://github.com/rlidwka/bevy_mod_physx/tree/8f66a9965eb461794856898ca44a1faf13c295ab) | Bevy 0.10 | PhysX 4 | | | | | | | other crates | [bevy_mod_physx](https://github.com/MasterOfMarkets/bevy_mod_physx) v0.1.0 | Bevy 0.10 | deprecated | | | [bevy_prototype_physx](https://github.com/superdump/bevy_prototype_physx) | Bevy 0.2-0.5 | unknown | | | [bevy_physx](https://crates.io/crates/bevy_physx) | | never existed | | | | | | *Note: you can find PhysX 4 version of this crate. It exists because PhysX 5 bindings don't have Vehicle API. It is not officially supported nor published to crates.io, and may get removed in the future.*