Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bevy 0.12 support #59

Merged
merged 9 commits into from
Nov 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@ homepage = "https://github.com/rewin123/space_editor"
repository = "https://github.com/rewin123/space_editor"

[dependencies]
bevy = "0.11"
bevy_egui = "0.21"
egui-gizmo = "0.11.0"
bevy-scene-hook = "7"
ron = "0.8.0"
bevy_panorbit_camera = "0.7.0"
bevy-inspector-egui = {version = "0.19.0", features = ["bevy_pbr", "highlight_changes"]}
bevy_mod_picking = {version = "0.15.0", features = ["backend_egui"]}
bevy_infinite_grid = "0.8.1"
egui_dock = "0.7"
egui_file = "0.10.2"
bevy = "0.12"
bevy_egui = "0.23"
egui-gizmo = "0.12"
bevy-scene-hook = "9"
ron = "0.8"
bevy_panorbit_camera = "0.9"
bevy-inspector-egui = {version = "0.21", features = ["bevy_pbr", "highlight_changes"]}
pretty-type-name = "1.0"
bevy_mod_picking = {version = "0.17", default-features = false, features = ["backend_raycast", "selection"]}
bevy_debug_grid = "0.3"
egui_dock = "0.8"
egui_file = "0.11"

bevy_xpbd_3d = {git = "https://github.com/Jondolf/bevy_xpbd.git", rev = "2e257b2910233af44a5f6571f4cb0c3817d010f0", default-features = false, optional = true}
bevy_xpbd_3d = {version="0.3", default-features = false, optional = true}

[profile.dev.package.bevy_xpbd_3d]
opt-level = 3
Expand Down
32 changes: 16 additions & 16 deletions assets/level_test.scn.ron
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
y: 1.5396833,
z: -25.659279,
),
rotation: (0.0, 0.0, 0.0, 1.0),
rotation: (x: 0.0, y: 0.0, z: 0.0, w: 1.0),
scale: (
x: 1.0,
y: 1.0,
Expand Down Expand Up @@ -102,7 +102,7 @@
y: 0.0,
z: -16.504646,
),
rotation: (0.0, 0.0, 0.0, 1.0),
rotation: (x: 0.0, y: 0.0, z: 0.0, w: 1.0),
scale: (
x: 1.0,
y: 1.0,
Expand Down Expand Up @@ -195,7 +195,7 @@
y: 0.0,
z: -6.3498917,
),
rotation: (0.0, 0.0, 0.0, 1.0),
rotation: (x: 0.0, y: 0.0, z: 0.0, w: 1.0),
scale: (
x: 1.0,
y: 1.0,
Expand Down Expand Up @@ -288,7 +288,7 @@
y: 0.21842504,
z: -0.4569779,
),
rotation: (0.0, -0.00000000046566123, 0.0, 1.0),
rotation: (x: 0.0, y: -0.00000000046566123, z: 0.0, w: 1.0),
scale: (
x: 1.0000001,
y: 1.0,
Expand Down Expand Up @@ -343,7 +343,7 @@
y: 0.0,
z: -25.785236,
),
rotation: (0.0, 0.0, 0.0, 1.0),
rotation: (x: 0.0, y: 0.0, z: 0.0, w: 1.0),
scale: (
x: 1.0,
y: 1.0,
Expand Down Expand Up @@ -436,7 +436,7 @@
y: -0.28648877,
z: -0.28093243,
),
rotation: (-0.6675922, 0.0, 0.0, 0.7445271),
rotation: (x: -0.6675922, y: 0.0, z: 0.0, w: 0.7445271),
scale: (
x: 1.0,
y: 1.0,
Expand Down Expand Up @@ -511,7 +511,7 @@
y: -0.07585633,
z: -0.5607872,
),
rotation: (0.0, 0.0, 0.0, 1.0),
rotation: (x: 0.0, y: 0.0, z: 0.0, w: 1.0),
scale: (
x: 1.0,
y: 1.0,
Expand Down Expand Up @@ -566,7 +566,7 @@
y: -1.2103212,
z: -25.835867,
),
rotation: (0.0, 0.0, 0.0, 1.0),
rotation: (x: 0.0, y: 0.0, z: 0.0, w: 1.0),
scale: (
x: 1.0,
y: 1.0,
Expand Down Expand Up @@ -659,7 +659,7 @@
y: 1.4635863,
z: -30.082056,
),
rotation: (-0.7019975, 0.0, 0.0, 0.7121794),
rotation: (x: -0.7019975, y: 0.0, z: 0.0, w: 0.7121794),
scale: (
x: 1.0,
y: 0.99999726,
Expand Down Expand Up @@ -734,7 +734,7 @@
y: 1.5396833,
z: -43.377647,
),
rotation: (0.0, 0.0, 0.0, 1.0),
rotation: (x: 0.0, y: 0.0, z: 0.0, w: 1.0),
scale: (
x: 1.0,
y: 1.0,
Expand Down Expand Up @@ -827,7 +827,7 @@
y: -0.000009655952,
z: 7.3677998,
),
rotation: (0.0, 0.0, 0.0, 1.0),
rotation: (x: 0.0, y: 0.0, z: 0.0, w: 1.0),
scale: (
x: 1.0,
y: 1.0,
Expand Down Expand Up @@ -920,7 +920,7 @@
y: 1.5396833,
z: -38.380207,
),
rotation: (0.0, 0.0, 0.0, 1.0),
rotation: (x: 0.0, y: 0.0, z: 0.0, w: 1.0),
scale: (
x: 1.0,
y: 1.0,
Expand Down Expand Up @@ -1013,7 +1013,7 @@
y: 0.21842492,
z: -0.45153165,
),
rotation: (0.0, -0.00000000046566123, 0.0, 1.0),
rotation: (x: 0.0, y: -0.00000000046566123, z: 0.0, w: 1.0),
scale: (
x: 1.0000001,
y: 0.99999964,
Expand Down Expand Up @@ -1068,7 +1068,7 @@
y: 0.0,
z: 2.2603722,
),
rotation: (0.0, 0.0, 0.0, 1.0),
rotation: (x: 0.0, y: 0.0, z: 0.0, w: 1.0),
scale: (
x: 1.0,
y: 1.0,
Expand Down Expand Up @@ -1161,7 +1161,7 @@
y: 2.7637057,
z: 6.4066534,
),
rotation: (-0.00000000033425, 0.71091986, -0.00000000033425004, -0.7032731),
rotation: (x: -0.00000000033425, y: 0.71091986, z: -0.00000000033425004, w: -0.7032731),
scale: (
x: 1.0000397,
y: 0.9999999,
Expand Down Expand Up @@ -1272,7 +1272,7 @@
y: 3.735711,
z: 0.0,
),
rotation: (-0.1146213, 0.6778526, 0.12107966, 0.716043),
rotation: (x: -0.1146213, y: 0.6778526, z: 0.12107966, w: 0.716043),
scale: (
x: 0.9999996,
y: 0.9999984,
Expand Down
10 changes: 5 additions & 5 deletions assets/physics_loading_test.scn.ron
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
y: 11.90253,
z: 0.574896,
),
rotation: (-0.0000000005767191, 0.7109159, -0.0000000005767191, -0.70327705),
rotation: (x: -0.0000000005767191, y: 0.7109159, z: -0.0000000005767191, w: -0.70327705),
scale: (
x: 1.0000631,
y: 1.0000006,
Expand Down Expand Up @@ -103,7 +103,7 @@
y: 0.21842492,
z: -0.45153165,
),
rotation: (0.0, -0.00000000046566123, 0.0, 1.0),
rotation: (x: 0.0, y: -0.00000000046566123, z: 0.0, w: 1.0),
scale: (
x: 1.0000001,
y: 0.99999964,
Expand Down Expand Up @@ -158,7 +158,7 @@
y: -0.000009655952,
z: 0.38997746,
),
rotation: (0.0, 0.0, 0.0, 1.0),
rotation: (x: 0.0, y: 0.0, z: 0.0, w: 1.0),
scale: (
x: 1.0,
y: 1.0,
Expand Down Expand Up @@ -251,7 +251,7 @@
y: 0.0,
z: -0.4533022,
),
rotation: (0.000000000000018831962, -0.00000000046566245, 0.0000000000019876305, 1.0),
rotation: (x: 0.000000000000018831962, y: -0.00000000046566245, z: 0.0000000000019876305, w: 1.0),
scale: (
x: 0.99999756,
y: 0.9999971,
Expand Down Expand Up @@ -306,7 +306,7 @@
y: 0.21842504,
z: -0.4569779,
),
rotation: (0.0, -0.00000000046566123, 0.0, 1.0),
rotation: (x: 0.0, y: -0.00000000046566123, z: 0.0, w: 1.0),
scale: (
x: 1.0000001,
y: 1.0,
Expand Down
10 changes: 5 additions & 5 deletions assets/tile.scn.ron
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
y: 0.0,
z: 0.0,
),
rotation: (0.0, 0.0, 0.0, 1.0),
rotation: (x: 0.0, y: 0.0, z: 0.0, w: 1.0),
scale: (
x: 2.4347973,
y: 0.15754807,
Expand All @@ -34,7 +34,7 @@
y: 0.13795531,
z: -2.1002147,
),
rotation: (0.0, 0.0, 0.0, 1.0),
rotation: (x: 0.0, y: 0.0, z: 0.0, w: 1.0),
scale: (
x: 0.4790529,
y: 0.36931515,
Expand All @@ -60,7 +60,7 @@
y: 0.13795531,
z: -2.0787163,
),
rotation: (0.0, 0.0, 0.0, 1.0),
rotation: (x: 0.0, y: 0.0, z: 0.0, w: 1.0),
scale: (
x: 0.4790529,
y: 0.36931515,
Expand All @@ -87,7 +87,7 @@
y: 0.13796866,
z: 2.0884218,
),
rotation: (0.0, 0.0, 0.0, 1.0),
rotation: (x: 0.0, y: 0.0, z: 0.0, w: 1.0),
scale: (
x: 0.4790529,
y: 0.36931515,
Expand All @@ -114,7 +114,7 @@
y: 0.13795578,
z: 2.0741177,
),
rotation: (0.0, 0.0, 0.0, 1.0),
rotation: (x: 0.0, y: 0.0, z: 0.0, w: 1.0),
scale: (
x: 0.4790529,
y: 0.36931515,
Expand Down
14 changes: 3 additions & 11 deletions examples/platformer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ use bevy::{
ecs::{entity::MapEntities, reflect::ReflectMapEntities},
prelude::*,
};
use bevy_xpbd_3d::{
prelude::{AngularVelocity, LinearVelocity, Position, RayHits},
PhysicsSchedule, PhysicsStepSet,
};
use bevy_xpbd_3d::prelude::{AngularVelocity, LinearVelocity, Position, RayHits};
use space_editor::prelude::{component::EntityLink, spatial_query::RayCasterPrefab, *};

fn main() {
Expand All @@ -28,12 +25,7 @@ fn main() {
"Simnple tab".into(),
simple_tab_system,
)
.add_systems(
PhysicsSchedule,
move_player
.run_if(in_state(EditorState::Game))
.before(PhysicsStepSet::BroadPhase),
)
.add_systems(Update, move_player.run_if(in_state(EditorState::Game)))
.add_systems(Update, camera_follow.run_if(in_state(EditorState::Game)))
.run();
}
Expand Down Expand Up @@ -105,7 +97,7 @@ fn move_player(
) {
for (_e, mut vel, mut rot, mut controller, hits, tranform) in query.iter_mut() {
//take 1th hit, because 0th hit is self hit
if let Some(hit) = hits.iter_sorted().nth(1) {
if let Some(hit) = hits.iter_sorted().next() {
if hit.time_of_impact > 0.7 {
continue;
}
Expand Down
15 changes: 8 additions & 7 deletions src/editor/core/gltf_unpack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn unpack_gltf_event(
assets: Res<AssetServer>,
mut queue: ResMut<GltfSceneQueue>,
) {
for event in events.iter() {
for event in events.read() {
queue.0.push(assets.load(event.path.clone()));
}
events.clear();
Expand All @@ -60,7 +60,7 @@ fn queue_push(
mut events: EventWriter<GltfLoaded>,
assets: Res<AssetServer>,
) {
if !queue.0.is_empty() && assets.get_load_state(&queue.0[0]) == LoadState::Loaded {
if !queue.0.is_empty() && assets.get_load_state(&queue.0[0]) == Some(LoadState::Loaded) {
events.send(GltfLoaded(queue.0.remove(0)));
}
}
Expand All @@ -76,18 +76,19 @@ fn unpack_gltf(world: &mut World) {
let loaded_scenes = {
let mut events = world.resource_mut::<Events<GltfLoaded>>();
let mut reader = events.get_reader();
let loaded = reader.iter(&events).cloned().collect::<Vec<GltfLoaded>>();
let loaded = reader.read(&events).cloned().collect::<Vec<GltfLoaded>>();
events.clear();
loaded
};

let mut command_queue = CommandQueue::default();
for gltf in loaded_scenes.iter() {
let handle: Handle<Gltf> = gltf.0.clone();
let gltf_path = world
.resource::<AssetServer>()
.get_handle_path(&handle)
.unwrap();
let gltf_path = if let Some(path) = handle.path() {
path.clone()
} else {
continue;
};
info!("Path: {:?}", &gltf_path);

let Some(gltf) = world.resource::<Assets<Gltf>>().get(&gltf.0) else {
Expand Down
4 changes: 2 additions & 2 deletions src/editor/core/load.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bevy::{ecs::entity::EntityMap, prelude::*};
use bevy::{prelude::*, utils::HashMap};

use crate::{prelude::EditorLoader, PrefabMarker};

Expand Down Expand Up @@ -34,7 +34,7 @@ pub fn load_listener(world: &mut World) {
entity.components.push(Box::new(PrefabMarker));
}

let mut map = EntityMap::default();
let mut map = HashMap::new();
let res = prefab.write_to_world(world, &mut map);
match res {
Ok(_) => { /*some info planned*/ }
Expand Down
2 changes: 1 addition & 1 deletion src/editor/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fn editor_event_listener(
cache: ResMut<PrefabMemoryCache>,
mut gltf_events: EventWriter<gltf_unpack::EditorUnpackGltf>,
) {
for event in events.iter() {
for event in events.read() {
match event {
EditorEvent::Load(path) => match path {
EditorPrefabPath::File(path) => {
Expand Down
Loading