diff --git a/Cargo.lock b/Cargo.lock index 3f33467..67b85ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -120,12 +120,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4aa90d7ce82d4be67b64039a3d588d38dbcc6736577de4a847025ce5b0c468d1" -[[package]] -name = "allocator-api2" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" - [[package]] name = "alsa" version = "0.9.1" @@ -1209,19 +1203,6 @@ version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df7370d0e46b60e071917711d0860721f5347bc958bf325975ae6913a5dfcf01" -[[package]] -name = "bevy_rapier3d" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdf74109573c2c82b05b217cb6101f7e71e6c53ad622aed6c370cc5783c59eb8" -dependencies = [ - "bevy", - "bitflags 2.9.0", - "log", - "nalgebra", - "rapier3d", -] - [[package]] name = "bevy_reflect" version = "0.16.1" @@ -1672,7 +1653,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "rustc-hash 1.1.0", + "rustc-hash", "shlex", "syn 2.0.101", ] @@ -2124,7 +2105,7 @@ dependencies = [ "fontdb", "log", "rangemap", - "rustc-hash 1.1.0", + "rustc-hash", "rustybuzz", "self_cell", "smol_str", @@ -2186,19 +2167,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" -[[package]] -name = "crossbeam" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-epoch", - "crossbeam-queue", - "crossbeam-utils", -] - [[package]] name = "crossbeam-channel" version = "0.5.15" @@ -2405,15 +2373,6 @@ dependencies = [ "bytemuck", ] -[[package]] -name = "ena" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5" -dependencies = [ - "log", -] - [[package]] name = "encase" version = "0.10.0" @@ -3025,7 +2984,6 @@ version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" dependencies = [ - "allocator-api2", "equivalent", "foldhash", "serde", @@ -3545,16 +3503,6 @@ dependencies = [ "regex-automata 0.1.10", ] -[[package]] -name = "matrixmultiply" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06de3016e9fae57a36fd14dba131fccf49f74b40b7fbdb472f96e361ec71a08" -dependencies = [ - "autocfg", - "rawpointer", -] - [[package]] name = "maybe-rayon" version = "0.1.1" @@ -3601,7 +3549,6 @@ version = "0.1.0" dependencies = [ "bevy", "bevy-inspector-egui", - "bevy_rapier3d", "bevy_skein", "bevy_third_person_camera", "bevy_ui_text_input", @@ -3654,7 +3601,7 @@ dependencies = [ "indexmap", "log", "pp-rs", - "rustc-hash 1.1.0", + "rustc-hash", "spirv", "strum", "termcolor", @@ -3676,40 +3623,12 @@ dependencies = [ "once_cell", "regex", "regex-syntax 0.8.5", - "rustc-hash 1.1.0", + "rustc-hash", "thiserror 1.0.69", "tracing", "unicode-ident", ] -[[package]] -name = "nalgebra" -version = "0.33.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26aecdf64b707efd1310e3544d709c5c0ac61c13756046aaaba41be5c4f66a3b" -dependencies = [ - "approx", - "glam", - "matrixmultiply", - "nalgebra-macros", - "num-complex", - "num-rational", - "num-traits", - "simba", - "typenum", -] - -[[package]] -name = "nalgebra-macros" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "254a5372af8fc138e36684761d3c0cdb758a4410e938babcff1c860ce14ddbfc" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.101", -] - [[package]] name = "ndk" version = "0.8.0" @@ -3888,15 +3807,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-complex" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" -dependencies = [ - "num-traits", -] - [[package]] name = "num-derive" version = "0.4.2" @@ -4313,15 +4223,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "ordered-float" -version = "5.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2c1f9f56e534ac6a9b8a4600bdf0f530fb393b5f393e7b4d03489c3cf0c3f01" -dependencies = [ - "num-traits", -] - [[package]] name = "overload" version = "0.1.1" @@ -4366,31 +4267,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "parry3d" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec55ce6f725367f8149f750575e79a8879d71b7257c02273259f9375822821f" -dependencies = [ - "approx", - "arrayvec", - "bitflags 2.9.0", - "downcast-rs 2.0.1", - "either", - "ena", - "hashbrown", - "log", - "nalgebra", - "num-derive", - "num-traits", - "ordered-float 5.0.0", - "rstar", - "simba", - "slab", - "spade", - "thiserror 2.0.12", -] - [[package]] name = "paste" version = "1.0.15" @@ -4675,32 +4551,6 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f60fcc7d6849342eff22c4350c8b9a989ee8ceabc4b481253e8946b9fe83d684" -[[package]] -name = "rapier3d" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a35ec3d01c4f918675411442024a1fbfb7eafdd878a6e82479ff6e461a9092fc" -dependencies = [ - "approx", - "arrayvec", - "bit-vec 0.8.0", - "bitflags 2.9.0", - "crossbeam", - "downcast-rs 2.0.1", - "log", - "nalgebra", - "num-derive", - "num-traits", - "ordered-float 5.0.0", - "parry3d", - "profiling", - "rayon", - "rustc-hash 2.1.1", - "simba", - "thiserror 2.0.12", - "vec_map", -] - [[package]] name = "rav1e" version = "0.7.1" @@ -4757,12 +4607,6 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" -[[package]] -name = "rawpointer" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" - [[package]] name = "rayon" version = "1.10.0" @@ -4873,12 +4717,6 @@ version = "0.8.50" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a" -[[package]] -name = "robust" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e27ee8bb91ca0adcf0ecb116293afa12d393f9c2b9b9cd54d33e8078fe19839" - [[package]] name = "rodio" version = "0.20.1" @@ -4907,17 +4745,6 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97" -[[package]] -name = "rstar" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "421400d13ccfd26dfa5858199c30a5d76f9c54e0dba7575273025b43c5175dbb" -dependencies = [ - "heapless", - "num-traits", - "smallvec", -] - [[package]] name = "rustc-demangle" version = "0.1.25" @@ -4930,12 +4757,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" -[[package]] -name = "rustc-hash" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" - [[package]] name = "rustc_version" version = "0.2.3" @@ -5009,15 +4830,6 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" -[[package]] -name = "safe_arch" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96b02de82ddbe1b636e6170c21be622223aea188ef2e139be0a5b219ec215323" -dependencies = [ - "bytemuck", -] - [[package]] name = "same-file" version = "1.0.6" @@ -5135,19 +4947,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" -[[package]] -name = "simba" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3a386a501cd104797982c15ae17aafe8b9261315b5d07e3ec803f2ea26be0fa" -dependencies = [ - "approx", - "num-complex", - "num-traits", - "paste", - "wide", -] - [[package]] name = "simd-adler32" version = "0.3.7" @@ -5244,18 +5043,6 @@ dependencies = [ "serde", ] -[[package]] -name = "spade" -version = "2.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a14e31a007e9f85c32784b04f89e6e194bb252a4d41b4a8ccd9e77245d901c8c" -dependencies = [ - "hashbrown", - "num-traits", - "robust", - "smallvec", -] - [[package]] name = "spin" version = "0.9.8" @@ -5689,12 +5476,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" -[[package]] -name = "typenum" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" - [[package]] name = "unicode-bidi" version = "0.3.18" @@ -6094,7 +5875,7 @@ dependencies = [ "parking_lot", "profiling", "raw-window-handle", - "rustc-hash 1.1.0", + "rustc-hash", "smallvec", "thiserror 2.0.12", "wgpu-hal", @@ -6131,13 +5912,13 @@ dependencies = [ "ndk-sys 0.5.0+25.2.9519653", "objc", "once_cell", - "ordered-float 4.6.0", + "ordered-float", "parking_lot", "profiling", "range-alloc", "raw-window-handle", "renderdoc-sys", - "rustc-hash 1.1.0", + "rustc-hash", "smallvec", "thiserror 2.0.12", "wasm-bindgen", @@ -6160,16 +5941,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "wide" -version = "0.7.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce5da8ecb62bcd8ec8b7ea19f69a51275e91299be594ea5cc6ef7819e16cd03" -dependencies = [ - "bytemuck", - "safe_arch", -] - [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index bbb75ed..f5d43e4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,6 @@ bevy_skein = { git = "https://github.com/rust-adventure/skein.git" } clap = { version = "4", features = ["derive"] } shlex = "1.3.0" bevy_ui_text_input = "0.5.2" -bevy_rapier3d = {version = "0.30.0", features = ["simd-stable", "debug-render", "parallel"]} # Enable a small amount of optimization in the dev profile. [profile.dev] diff --git a/assets/gltf/test.bin b/assets/gltf/test.bin deleted file mode 100644 index a89be86..0000000 Binary files a/assets/gltf/test.bin and /dev/null differ diff --git a/assets/gltf/test.glb b/assets/gltf/test.glb index 2ce8171..ce0c44b 100644 Binary files a/assets/gltf/test.glb and b/assets/gltf/test.glb differ diff --git a/assets/gltf/test.gltf b/assets/gltf/test.gltf deleted file mode 100644 index 75198c1..0000000 --- a/assets/gltf/test.gltf +++ /dev/null @@ -1,237 +0,0 @@ -{ - "asset":{ - "generator":"Khronos glTF Blender I/O v4.4.56", - "version":"2.0" - }, - "scene":0, - "scenes":[ - { - "extras":{ - "skein_extension_properties":{ - "enabled":1 - } - }, - "name":"Scene", - "nodes":[ - 0, - 1 - ] - } - ], - "nodes":[ - { - "extras":{ - "skein_two":[ - { - "name":"TPCTarget", - "selected_type_path":"mgd2_demonic_posession::TPCTarget" - }, - { - "name":"StaticColliderConfig", - "selected_type_path":"mgd2_demonic_posession::game::scene::StaticColliderConfig", - "mgd2_demonic_posession::game::scene::StaticColliderConfig":{ - "x":10.0, - "y":5.0, - "z":1.0 - } - } - ], - "active_component_index":1, - "skein":[ - { - "mgd2_demonic_posession::TPCTarget":{} - }, - { - "mgd2_demonic_posession::game::scene::StaticColliderConfig":{ - "x":10.0, - "y":5.0, - "z":1.0 - } - } - ] - }, - "mesh":0, - "name":"Cube" - }, - { - "extras":{ - "skein_two":[ - { - "name":"StaticColliderConfig", - "selected_type_path":"mgd2_demonic_posession::game::scene::StaticColliderConfig", - "mgd2_demonic_posession::game::scene::StaticColliderConfig":{ - "y":2.0, - "z":2.0, - "x":2.0 - } - } - ], - "active_component_index":0, - "skein":[ - { - "mgd2_demonic_posession::game::scene::StaticColliderConfig":{ - "x":2.0, - "y":2.0, - "z":2.0 - } - } - ] - }, - "mesh":1, - "name":"Cube.001", - "rotation":[ - 0, - 0.3594704866409302, - 0, - 0.9331565499305725 - ], - "translation":[ - 0, - 1.5, - 0 - ] - } - ], - "meshes":[ - { - "name":"Cube.001", - "primitives":[ - { - "attributes":{ - "POSITION":0, - "NORMAL":1, - "TEXCOORD_0":2 - }, - "indices":3 - } - ] - }, - { - "name":"Cube", - "primitives":[ - { - "attributes":{ - "POSITION":4, - "NORMAL":5, - "TEXCOORD_0":6 - }, - "indices":3 - } - ] - } - ], - "accessors":[ - { - "bufferView":0, - "componentType":5126, - "count":24, - "max":[ - 5, - 0.5, - 2.5 - ], - "min":[ - -5, - -0.5, - -2.5 - ], - "type":"VEC3" - }, - { - "bufferView":1, - "componentType":5126, - "count":24, - "type":"VEC3" - }, - { - "bufferView":2, - "componentType":5126, - "count":24, - "type":"VEC2" - }, - { - "bufferView":3, - "componentType":5123, - "count":36, - "type":"SCALAR" - }, - { - "bufferView":4, - "componentType":5126, - "count":24, - "max":[ - 1, - 1, - 1 - ], - "min":[ - -1, - -1, - -1 - ], - "type":"VEC3" - }, - { - "bufferView":5, - "componentType":5126, - "count":24, - "type":"VEC3" - }, - { - "bufferView":6, - "componentType":5126, - "count":24, - "type":"VEC2" - } - ], - "bufferViews":[ - { - "buffer":0, - "byteLength":288, - "byteOffset":0, - "target":34962 - }, - { - "buffer":0, - "byteLength":288, - "byteOffset":288, - "target":34962 - }, - { - "buffer":0, - "byteLength":192, - "byteOffset":576, - "target":34962 - }, - { - "buffer":0, - "byteLength":72, - "byteOffset":768, - "target":34963 - }, - { - "buffer":0, - "byteLength":288, - "byteOffset":840, - "target":34962 - }, - { - "buffer":0, - "byteLength":288, - "byteOffset":1128, - "target":34962 - }, - { - "buffer":0, - "byteLength":192, - "byteOffset":1416, - "target":34962 - } - ], - "buffers":[ - { - "byteLength":1608, - "uri":"test.bin" - } - ] -} diff --git a/blender/test.blend b/blender/test.blend index 2f7433e..f115804 100644 Binary files a/blender/test.blend and b/blender/test.blend differ diff --git a/src/debug.rs b/src/debug.rs index c416d5e..10d5330 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -2,8 +2,7 @@ use std::{fs, path::PathBuf}; use bevy::prelude::*; -use bevy_inspector_egui::{bevy_egui::EguiPlugin, quick::WorldInspectorPlugin}; -use bevy_rapier3d::render::RapierDebugRenderPlugin; +use bevy_inspector_egui::bevy_egui::EguiPlugin; use clap::Subcommand; use console::exec_script; @@ -37,11 +36,7 @@ pub fn plugin(app: &mut App) { .in_set(DebugSet), ) .add_systems(Startup, startup_file.pipe(exec_script)) - .add_plugins(( - console::plugin, - WorldInspectorPlugin::default(), - RapierDebugRenderPlugin::default().disabled(), - )); + .add_plugins(console::plugin); } fn start_game( diff --git a/src/debug/debug_event.rs b/src/debug/debug_event.rs index 8c2c55f..0c530cc 100644 --- a/src/debug/debug_event.rs +++ b/src/debug/debug_event.rs @@ -50,26 +50,11 @@ pub enum DebugEvent { /// Debug mode cannot be disabled. Just restart the game lmao. /// /// Current debug mode behaviour: - /// - You can load gtlf scenes + /// - Nothing #[command(name = "enable-debug", aliases = ["debug-enable"])] EnableDebugMode, /// Load a gltf scene. - /// - /// Auto-reloading isn't possible due to engine reasons, see: - /// https://github.com/bevyengine/bevy/pull/18358 #[command(name = "load-scene", aliases = ["load-file", "load"])] - LoadGltf { - /// The asset path of the item. - asset_path: String, - /// Id for the item, so it can easily be selected using other debug tools. - id: Option, - }, - - /// Despawn an entity by string id. Uniqueness of Ids isn't guaranteed. - Despawn { id: String }, - - /// Toggles rapier debug mode - #[command(aliases = ["rapier-debug", "rapier"])] - DebugRapier, + LoadGltf { asset_path: String }, } diff --git a/src/game.rs b/src/game.rs index 6eaa6c0..16c67c0 100644 --- a/src/game.rs +++ b/src/game.rs @@ -16,9 +16,15 @@ struct GameplaySet; pub fn plugin(app: &mut App) { app.add_systems( + OnEnter(AppState::Ingame), + scene::setup + .in_set(GameplaySet) + .run_if(in_state(DebugMode::Disabled)), + ) + .add_systems( OnExit(AppState::Ingame), despawn::.in_set(GameplaySet), ) - .add_plugins((camera::plugin, scene::plugin, debug::plugin)); + .add_plugins((camera::plugin, debug::plugin)); app.configure_sets(Update, GameplaySet.run_if(in_state(AppState::Ingame))); } diff --git a/src/game/debug.rs b/src/game/debug.rs index 187e8e7..20a7fce 100644 --- a/src/game/debug.rs +++ b/src/game/debug.rs @@ -1,30 +1,14 @@ -use std::path::PathBuf; - -use bevy::{ - asset::{AssetPath, io::AssetSourceEvent}, - prelude::*, -}; -use bevy_rapier3d::render::DebugRenderContext; +use bevy::{asset::AssetPath, prelude::*}; use crate::debug::{ConsoleLog, DebugEvent, DebugMode}; pub fn plugin(app: &mut App) { app.add_systems( Update, - ( - handle_load_gltf.run_if(in_state(DebugMode::Enabled)), - handle_despawn, - handle_debug_rapier, - ), + handle_load_gltf.run_if(in_state(DebugMode::Enabled)), ); } -#[derive(Component, Clone)] -struct Id(String); - -#[derive(Component)] -struct HasPath(String); - fn handle_load_gltf( mut c: Commands, mut dbg_reader: EventReader, @@ -32,64 +16,11 @@ fn handle_load_gltf( asset_server: Res, ) { for ev in dbg_reader.read() { - if let DebugEvent::LoadGltf { asset_path, id } = ev { - logger.write(&format!("Loading {asset_path}...")); + if let DebugEvent::LoadGltf { asset_path } = ev { let scene_handle = asset_server .load(GltfAssetLabel::Scene(0).from_asset(AssetPath::from(asset_path.clone()))); - let mut scene = c.spawn((SceneRoot(scene_handle), HasPath(asset_path.clone()))); - - if let Some(id) = id { - scene.insert(Id(id.clone())); - } - logger.write( - "Should be loaded now. If nothing happened, check if you might've typoed the path.", - ); - } - } -} - -fn handle_despawn( - mut c: Commands, - mut dbg_reader: EventReader, - mut logger: ResMut, - entities: Query<(Entity, &Id)>, -) { - for ev in dbg_reader.read() { - if let DebugEvent::Despawn { id: target_id } = ev { - let mut count = 0; - entities - .iter() - .filter_map(|(entity, Id(id))| (id == target_id).then_some(entity)) - .for_each(|entity| { - count += 1; - c.entity(entity).despawn() - }); - - if count > 0 { - logger.write(&format!("Despawned {count} entities.")); - } else { - logger.err(&format!( - "Couldn't find any entities to despawn with id {target_id:?}." - )) - } - } - } -} - -fn handle_debug_rapier( - mut dbg_reader: EventReader, - mut logger: ResMut, - mut rapier_ctx: ResMut, -) { - for ev in dbg_reader.read() { - if &DebugEvent::DebugRapier == ev { - rapier_ctx.enabled = !rapier_ctx.enabled; - logger.write(if rapier_ctx.enabled { - "Enabled Rapier debug rendering." - } else { - "Disabled Rapier debug rendering." - }) + c.spawn(SceneRoot(scene_handle)); } } } diff --git a/src/game/scene.rs b/src/game/scene.rs index 200b9ac..059f0b8 100644 --- a/src/game/scene.rs +++ b/src/game/scene.rs @@ -1,32 +1,21 @@ use bevy::prelude::*; -use bevy_rapier3d::prelude::{Collider, RigidBody}; use bevy_third_person_camera::ThirdPersonCameraTarget; -use log::info; -use crate::{AppState, cleanup}; +use crate::cleanup; -pub fn plugin(app: &mut App) { - app.register_type::() - // .add_systems(OnEnter(AppState::Ingame), test_spawn_on_init) - .add_systems(Update, add_colliders_to_things_that_need_them); -} - -// uses blender coords -#[derive(Component, Clone, Copy, Reflect)] -#[reflect(Component)] -pub struct StaticColliderConfig { - x: f32, - y: f32, - z: f32, -} - -fn add_colliders_to_things_that_need_them( +pub fn setup( mut c: Commands, - to_modify: Query<(Entity, &StaticColliderConfig), Without>, + asset_server: Res, + mut meshes: ResMut>, + mut materials: ResMut>, ) { - for (entity, StaticColliderConfig { x, y, z }) in to_modify.iter() { - info!("meow"); - c.entity(entity) - .insert(Collider::cuboid(*x / 2., *z / 2., -*y / 2.)); - } + let scene_handle = asset_server.load(GltfAssetLabel::Scene(0).from_asset("gltf/test.glb")); + c.spawn(( + Mesh3d(meshes.add(Cuboid::new(1., 1., 1.))), + MeshMaterial3d(materials.add(Color::BLACK)), + ThirdPersonCameraTarget, + cleanup::Scene, + )); + c.spawn(SceneRoot(scene_handle)); + info!("Scene spawned!") } diff --git a/src/main.rs b/src/main.rs index ea6b115..be9794e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,5 @@ #![feature(iter_collect_into)] use bevy::prelude::*; -use bevy_rapier3d::plugin::{NoUserData, RapierPhysicsPlugin}; use bevy_skein::SkeinPlugin; use bevy_ui_text_input::TextInputPlugin; use clap::ValueEnum; @@ -25,12 +24,7 @@ fn main() { .register_type::() .add_systems(Startup, camera::setup) .add_plugins((DefaultPlugins, TextInputPlugin)) - .add_plugins(( - RapierPhysicsPlugin::::default(), - game::plugin, - menus::plugin, - debug::plugin, - )) + .add_plugins((game::plugin, menus::plugin, debug::plugin)) .add_plugins(SkeinPlugin::default()) .init_state::() .register_type::() diff --git a/startup.tx b/startup.tx index a0774e5..2ce0900 100644 --- a/startup.tx +++ b/startup.tx @@ -2,4 +2,4 @@ log "hello from startup script!!" enable-debug start-game -load-scene gltf/test.gltf test +load-scene gltf/test.glb diff --git a/test.tx b/test.tx deleted file mode 100644 index 8bc5c78..0000000 --- a/test.tx +++ /dev/null @@ -1,2 +0,0 @@ -despawn test -load-scene gltf/test.gltf test