Merge branch 'main' of github.com-personal:Back777space/among-me
This commit is contained in:
commit
75ed6c97ec
8 files changed
+23
-3
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -12,14 +12,34 @@ fn spawn_level(
|
||||
gltf_assets: Res<GltfAssets>
|
||||
) {
|
||||
println!("LIBRARY: {:?}", gltf_assets.library);
|
||||
let mut x_offset = 0.0;
|
||||
for mesh_name in ["corner_inside", "corner_outside", "wall", "door", "round_door", "round_hole"] {
|
||||
let shapes = ["corner_inside", "corner_outside", "wall", "door", "round_door", "round_hole"].map(|mesh_name| {
|
||||
let path = format!("meshes/library/space_{}.glb", mesh_name);
|
||||
let handle = gltf_assets.library.get(&path).expect(&format!("Couldn't find {} in library", mesh_name));
|
||||
let gltf = models.get(handle).expect(&format!("No model for {}", mesh_name));
|
||||
|
||||
let asset = gltf.default_scene.as_ref().expect(&format!("No scene in {}", mesh_name));
|
||||
commands.spawn((SceneRoot(asset.clone()), TransformBundle::from_transform(Transform::from_xyz(x_offset, 0.0, 0.0))));
|
||||
SceneRoot(asset.clone())
|
||||
});
|
||||
let [
|
||||
corner_inside,
|
||||
corner_outside,
|
||||
wall,
|
||||
door,
|
||||
round_door,
|
||||
round_hole
|
||||
] = shapes;
|
||||
let mut x_offset = 0.0;
|
||||
for i in 0..10 {
|
||||
commands.spawn((
|
||||
wall.clone(),
|
||||
Transform::from_xyz(i as f32 * 2.0, 0.0, 0.0),
|
||||
));
|
||||
|
||||
commands.spawn((
|
||||
wall.clone(),
|
||||
Transform::from_xyz(i as f32 * 2.0, 0.0, 0.0)
|
||||
.with_rotation(Quat::from_rotation_y(std::f32::consts::PI)),
|
||||
));
|
||||
x_offset += 2.0;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user