├── demos ├── assets │ ├── .gitkeep │ ├── player.glb │ ├── sensor-text.glb │ ├── FiraSans-Bold.ttf │ ├── solver-groups-text.glb │ └── collision-groups-text.glb ├── src │ ├── util │ │ ├── mod.rs │ │ └── animating.rs │ ├── character_animating_systems │ │ └── mod.rs │ ├── hacks │ │ ├── mod.rs │ │ └── for_2d_in_multibuild.rs │ ├── levels_setup │ │ ├── helper │ │ │ └── mod.rs │ │ ├── planet_2d.rs │ │ ├── planet_3d.rs │ │ ├── dynamic_bodies_3d.rs │ │ ├── compound_colliders_2d.rs │ │ ├── dynamic_bodies_2d.rs │ │ ├── compound_colliders_3d.rs │ │ ├── jungle_gym_2d.rs │ │ ├── mod.rs │ │ ├── jungle_gym.rs │ │ ├── pushback_3d.rs │ │ ├── for_2d_platformer.rs │ │ ├── for_3d_platformer.rs │ │ └── level_switching.rs │ ├── character_control_systems │ │ ├── querying_helpers.rs │ │ ├── mod.rs │ │ ├── info_dumpeing_systems.rs │ │ └── spatial_ext_facade.rs │ ├── level_mechanics │ │ ├── time_to_despawn.rs │ │ ├── mod.rs │ │ ├── push_effect.rs │ │ ├── center_of_gravity.rs │ │ ├── moving_platform.rs │ │ └── cannon.rs │ ├── lib.rs │ ├── ui │ │ ├── level_selection.rs │ │ ├── info.rs │ │ ├── framerate.rs │ │ ├── component_alterbation.rs │ │ └── plotting.rs │ └── app_setup_options.rs └── Cargo.toml ├── .gitignore ├── assets └── player.glb ├── physics-integration-layer ├── src │ ├── subservient_sensors.rs │ ├── spatial_ext.rs │ ├── obstacle_radar.rs │ ├── math.rs │ └── lib.rs ├── Cargo.toml └── CHANGELOG.md ├── shell.nix ├── src ├── builtins │ ├── mod.rs │ ├── wall_slide.rs │ ├── knockback.rs │ ├── dash.rs │ └── climb.rs ├── control_helpers │ ├── mod.rs │ ├── blip_reuse_avoidance.rs │ └── simple_fall_through_platforms.rs ├── util │ ├── velocity_boundary.rs │ └── command_impl_helpers.rs ├── animating_helper.rs ├── radar_lens.rs └── lib.rs ├── rapier2d ├── Cargo.toml └── src │ ├── helpers.rs │ └── spatial_ext.rs ├── rapier3d ├── Cargo.toml ├── src │ ├── helpers.rs │ └── spatial_ext.rs └── CHANGELOG.md ├── avian3d ├── Cargo.toml ├── src │ └── spatial_ext.rs └── CHANGELOG.md ├── avian2d ├── Cargo.toml └── src │ └── spatial_ext.rs ├── run-retrospective-crate-version-tagging.sh ├── LICENSE-MIT ├── Cargo.toml ├── examples └── example.rs └── MIGRATION-GUIDES.md /demos/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | Cargo.lock 3 | -------------------------------------------------------------------------------- /demos/src/util/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod animating; 2 | -------------------------------------------------------------------------------- /assets/player.glb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idanarye/bevy-tnua/HEAD/assets/player.glb -------------------------------------------------------------------------------- /demos/src/character_animating_systems/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod platformer_animating_systems; 2 | -------------------------------------------------------------------------------- /demos/assets/player.glb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idanarye/bevy-tnua/HEAD/demos/assets/player.glb -------------------------------------------------------------------------------- /demos/assets/sensor-text.glb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idanarye/bevy-tnua/HEAD/demos/assets/sensor-text.glb -------------------------------------------------------------------------------- /demos/assets/FiraSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idanarye/bevy-tnua/HEAD/demos/assets/FiraSans-Bold.ttf -------------------------------------------------------------------------------- /demos/assets/solver-groups-text.glb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idanarye/bevy-tnua/HEAD/demos/assets/solver-groups-text.glb -------------------------------------------------------------------------------- /demos/src/hacks/mod.rs: -------------------------------------------------------------------------------- 1 | mod for_2d_in_multibuild; 2 | 3 | pub use for_2d_in_multibuild::Register3dResourcesInThe2dDemos; 4 | -------------------------------------------------------------------------------- /demos/assets/collision-groups-text.glb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idanarye/bevy-tnua/HEAD/demos/assets/collision-groups-text.glb -------------------------------------------------------------------------------- /physics-integration-layer/src/subservient_sensors.rs: -------------------------------------------------------------------------------- 1 | use bevy::prelude::*; 2 | 3 | #[derive(Component)] 4 | pub struct TnuaSubservientSensor { 5 | pub owner_entity: Entity, 6 | } 7 | -------------------------------------------------------------------------------- /demos/src/levels_setup/helper/mod.rs: -------------------------------------------------------------------------------- 1 | mod helper2d; 2 | mod helper3d; 3 | 4 | pub use helper2d::{LevelSetupHelper2d, LevelSetupHelper2dEntityCommandsExtension}; 5 | pub use helper3d::{LevelSetupHelper3d, LevelSetupHelper3dEntityCommandsExtension}; 6 | -------------------------------------------------------------------------------- /demos/src/character_control_systems/querying_helpers.rs: -------------------------------------------------------------------------------- 1 | use bevy::ecs::query::QueryData; 2 | use bevy::prelude::*; 3 | 4 | use crate::level_mechanics::Climbable; 5 | 6 | #[derive(QueryData)] 7 | pub struct ObstacleQueryHelper { 8 | pub climbable: Has, 9 | } 10 | -------------------------------------------------------------------------------- /demos/src/character_control_systems/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod info_dumpeing_systems; 2 | pub mod platformer_control_systems; 3 | mod querying_helpers; 4 | mod spatial_ext_facade; 5 | 6 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] 7 | pub enum Dimensionality { 8 | Dim2, 9 | Dim3, 10 | } 11 | -------------------------------------------------------------------------------- /shell.nix: -------------------------------------------------------------------------------- 1 | { pkgs ? import { } }: 2 | 3 | with pkgs; 4 | 5 | mkShell rec { 6 | nativeBuildInputs = [ 7 | pkg-config 8 | ]; 9 | buildInputs = [ 10 | udev alsa-lib vulkan-loader cmake rustfmt jdk21 openssl 11 | xorg.libX11 xorg.libXcursor xorg.libXi xorg.libXrandr # To use the x11 feature 12 | libxkbcommon wayland # To use the wayland feature 13 | ]; 14 | LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs; 15 | } 16 | -------------------------------------------------------------------------------- /demos/src/levels_setup/planet_2d.rs: -------------------------------------------------------------------------------- 1 | use bevy::prelude::*; 2 | 3 | use crate::level_mechanics::IsCenterOfGraity; 4 | 5 | use super::helper::LevelSetupHelper2d; 6 | use super::PositionPlayer; 7 | 8 | pub fn setup_level(mut helper: LevelSetupHelper2d) { 9 | helper.spawn(PositionPlayer::from(Vec3::new(0.0, 25.0, 0.0))); 10 | 11 | helper 12 | .spawn_circle("Planet", Transform::from_xyz(0.0, 5.0, 0.0), 15.0) 13 | .insert(IsCenterOfGraity); 14 | } 15 | -------------------------------------------------------------------------------- /demos/src/levels_setup/planet_3d.rs: -------------------------------------------------------------------------------- 1 | use bevy::color::palettes::css; 2 | use bevy::prelude::*; 3 | 4 | use crate::level_mechanics::IsCenterOfGraity; 5 | 6 | use super::helper::LevelSetupHelper3d; 7 | use super::PositionPlayer; 8 | 9 | pub fn setup_level(mut helper: LevelSetupHelper3d) { 10 | helper.spawn(PositionPlayer::from(Vec3::new(0.0, 25.0, 0.0))); 11 | 12 | helper 13 | .with_color(css::DARK_GRAY.with_alpha(0.5)) 14 | .spawn_ball("Planet", Transform::from_xyz(0.0, 10.0, 0.0), 10.0) 15 | .insert(IsCenterOfGraity); 16 | } 17 | -------------------------------------------------------------------------------- /src/builtins/mod.rs: -------------------------------------------------------------------------------- 1 | mod climb; 2 | mod crouch; 3 | mod dash; 4 | mod jump; 5 | mod knockback; 6 | mod walk; 7 | mod wall_slide; 8 | 9 | pub use climb::{TnuaBuiltinClimb, TnuaBuiltinClimbState}; 10 | pub use crouch::{TnuaBuiltinCrouch, TnuaBuiltinCrouchState}; 11 | pub use dash::{TnuaBuiltinDash, TnuaBuiltinDashState}; 12 | pub use jump::{TnuaBuiltinJump, TnuaBuiltinJumpState}; 13 | pub use knockback::{TnuaBuiltinKnockback, TnuaBuiltinKnockbackState}; 14 | pub use walk::{TnuaBuiltinWalk, TnuaBuiltinWalkState}; 15 | pub use wall_slide::{TnuaBuiltinWallSlide, TnuaBuiltinWallSlideState}; 16 | -------------------------------------------------------------------------------- /physics-integration-layer/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "bevy-tnua-physics-integration-layer" 3 | description = "Components for integrating physics backends with bevy-tnua" 4 | version = "0.10.0" 5 | edition.workspace = true 6 | authors.workspace = true 7 | license.workspace = true 8 | repository.workspace = true 9 | categories.workspace = true 10 | keywords.workspace = true 11 | documentation = "https://docs.rs/bevy-tnua-physics-integration-layer" 12 | readme = "../README.md" 13 | 14 | [dependencies] 15 | bevy = { version = "^0.17", default-features = false } 16 | 17 | [features] 18 | f64 = [] 19 | -------------------------------------------------------------------------------- /demos/src/hacks/for_2d_in_multibuild.rs: -------------------------------------------------------------------------------- 1 | use bevy::prelude::*; 2 | 3 | /// The CI builds the WASM demos with both 2D and 3D variations, but since we don't load the 3D 4 | /// plugins of the physics backend crates in this demo some of resources required for some of the 5 | /// systems are not reigstered. This registers them, so that the systems are not broken. 6 | pub struct Register3dResourcesInThe2dDemos; 7 | 8 | impl Plugin for Register3dResourcesInThe2dDemos { 9 | fn build(&self, #[allow(unused)] app: &mut App) { 10 | #[cfg(feature = "avian3d")] 11 | app.add_message::(); 12 | #[cfg(feature = "rapier3d")] 13 | app.add_message::(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /demos/src/levels_setup/dynamic_bodies_3d.rs: -------------------------------------------------------------------------------- 1 | use bevy::color::palettes::css; 2 | use bevy::prelude::*; 3 | use bevy_tnua::TnuaNotPlatform; 4 | 5 | use super::helper::LevelSetupHelper3d; 6 | use super::PositionPlayer; 7 | 8 | pub fn setup_level(mut helper: LevelSetupHelper3d) { 9 | helper.spawn(PositionPlayer::from(Vec3::new(0.0, 10.0, 0.0))); 10 | 11 | helper.spawn_floor(css::WHITE); 12 | 13 | helper 14 | .with_color(css::ORANGE_RED) 15 | .spawn_dynamic_ball("Nonplatform Ball", Transform::from_xyz(4.0, 4.0, 0.0), 0.45) 16 | .insert(TnuaNotPlatform); 17 | 18 | helper.with_color(css::GREEN_YELLOW).spawn_dynamic_ball( 19 | "Platform Ball", 20 | Transform::from_xyz(-4.0, 4.0, 0.0), 21 | 0.45, 22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /src/control_helpers/mod.rs: -------------------------------------------------------------------------------- 1 | //! Various helpers to make Tnua's advanced features easier to use. 2 | //! 3 | //! See 4 | //! 5 | //! Tnua exposes its mid-level data for user systems to allow as much flexibility and 6 | //! customizability as it can provide. This, however, means that some of the advanced features can 7 | //! be complex to use. This module provides helpers that allow using these features in an easier 8 | //! although less flexible way. 9 | mod air_actions_tracking; 10 | mod blip_reuse_avoidance; 11 | mod crouch_enforcer; 12 | mod simple_fall_through_platforms; 13 | 14 | pub use air_actions_tracking::*; 15 | pub use blip_reuse_avoidance::*; 16 | pub use crouch_enforcer::*; 17 | pub use simple_fall_through_platforms::*; 18 | -------------------------------------------------------------------------------- /demos/src/level_mechanics/time_to_despawn.rs: -------------------------------------------------------------------------------- 1 | use bevy::prelude::*; 2 | 3 | pub struct TimeToDespawnPlugin; 4 | 5 | impl Plugin for TimeToDespawnPlugin { 6 | fn build(&self, app: &mut App) { 7 | app.add_systems(Update, handle_despawn); 8 | } 9 | } 10 | 11 | #[derive(Component)] 12 | pub struct TimeToDespawn(Timer); 13 | 14 | impl TimeToDespawn { 15 | pub fn from_seconds(duration: f32) -> Self { 16 | Self(Timer::from_seconds(duration, TimerMode::Once)) 17 | } 18 | } 19 | 20 | fn handle_despawn( 21 | time: Res