Updated to Bevy 0.15.1
This commit is contained in:
@@ -6,15 +6,15 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
bevy = "0.14.2"
|
||||
bevy = "0.15.1"
|
||||
world_generation = { path = "../../engine/world_generation" }
|
||||
shared = { path = "../shared" }
|
||||
bevy_rapier3d = "0.27.0"
|
||||
bevy_rapier3d = "0.28.0"
|
||||
serde = { version = "1.0.204", features = ["derive"] }
|
||||
asset_loader = { path = "../../engine/asset_loader" }
|
||||
serde_json = "1.0.120"
|
||||
ron = "0.8.1"
|
||||
bevy_asset_loader = { version = "0.21.0", features = [
|
||||
bevy_asset_loader = { version = "0.22.0", features = [
|
||||
"standard_dynamic_assets",
|
||||
"3d",
|
||||
] }
|
||||
|
||||
@@ -51,17 +51,18 @@ impl BuildingAsset {
|
||||
if let Some(gltf_mesh) = meshes.get(mesh_handle.id()) {
|
||||
let (mesh, mat) = gltf_mesh.unpack();
|
||||
let mut entity = commands.spawn((
|
||||
PbrBundle {
|
||||
mesh,
|
||||
material: mat,
|
||||
transform: Transform::from_translation(pos).with_rotation(rot),
|
||||
..Default::default()
|
||||
},
|
||||
Mesh3d(mesh),
|
||||
MeshMaterial3d(mat),
|
||||
Transform::from_translation(pos).with_rotation(rot),
|
||||
Building,
|
||||
));
|
||||
entity.with_children(|b| {
|
||||
for child in &node.children {
|
||||
self.process_node(child, meshes, b, &node.name);
|
||||
let child_node = nodes.get(child.id());
|
||||
if child_node.is_none() {
|
||||
continue;
|
||||
}
|
||||
self.process_node(child_node.unwrap(), meshes, nodes, b, &node.name);
|
||||
}
|
||||
});
|
||||
if let Some(component) = self.get_component_def(&format!("/{0}", &node.name)) {
|
||||
@@ -78,6 +79,7 @@ impl BuildingAsset {
|
||||
&self,
|
||||
node: &GltfNode,
|
||||
meshes: &Assets<GltfMesh>,
|
||||
nodes: &Assets<GltfNode>,
|
||||
commands: &mut ChildBuilder,
|
||||
parent: &String,
|
||||
) -> Option<Entity> {
|
||||
@@ -85,18 +87,14 @@ impl BuildingAsset {
|
||||
if let Some(mesh) = &node.mesh {
|
||||
if let Some(gltf_mesh) = meshes.get(mesh.id()) {
|
||||
let (mesh, mat) = gltf_mesh.unpack();
|
||||
let mut entity = commands.spawn((
|
||||
PbrBundle {
|
||||
mesh,
|
||||
material: mat,
|
||||
transform: node.transform,
|
||||
..Default::default()
|
||||
},
|
||||
Building,
|
||||
));
|
||||
let mut entity = commands.spawn((Mesh3d(mesh), MeshMaterial3d(mat), node.transform, Building));
|
||||
entity.with_children(|b| {
|
||||
for child in &node.children {
|
||||
self.process_node(child, meshes, b, &path);
|
||||
let child_node = nodes.get(child.id());
|
||||
if child_node.is_none() {
|
||||
continue;
|
||||
}
|
||||
self.process_node(child_node.unwrap(), meshes, nodes, b, &path);
|
||||
}
|
||||
});
|
||||
if let Some(component) = self.get_component_def(&path) {
|
||||
|
||||
@@ -110,12 +110,9 @@ fn hq_placement(
|
||||
fn show_indicators(positions: Vec<Vec3>, commands: &mut Commands, indicator: &IndicatorCube) {
|
||||
for p in positions {
|
||||
commands.spawn((
|
||||
PbrBundle {
|
||||
mesh: indicator.0.clone(),
|
||||
material: indicator.1.clone(),
|
||||
transform: Transform::from_translation(p),
|
||||
..default()
|
||||
},
|
||||
Mesh3d(indicator.0.clone()),
|
||||
MeshMaterial3d(indicator.1.clone()),
|
||||
Transform::from_translation(p),
|
||||
Despawn,
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user