mirror of
https://github.com/bevyengine/bevy
synced 2024-11-23 05:03:47 +00:00
c6958b3056
# Objective - Spawning a scene is handled as a special case with a command `spawn_scene` that takes an handle but doesn't let you specify anything else. This is the only handle that works that way. - Workaround for this have been to add the `spawn_scene` on `ChildBuilder` to be able to specify transform of parent, or to make the `SceneSpawner` available to be able to select entities from a scene by their instance id ## Solution Add a bundle ```rust pub struct SceneBundle { pub scene: Handle<Scene>, pub transform: Transform, pub global_transform: GlobalTransform, pub instance_id: Option<InstanceId>, } ``` and instead of ```rust commands.spawn_scene(asset_server.load("models/FlightHelmet/FlightHelmet.gltf#Scene0")); ``` you can do ```rust commands.spawn_bundle(SceneBundle { scene: asset_server.load("models/FlightHelmet/FlightHelmet.gltf#Scene0"), ..Default::default() }); ``` The scene will be spawned as a child of the entity with the `SceneBundle` ~I would like to remove the command `spawn_scene` in favor of this bundle but didn't do it yet to get feedback first~ Co-authored-by: François <8672791+mockersf@users.noreply.github.com> Co-authored-by: Carter Anderson <mcanders1@gmail.com>
27 lines
992 B
TOML
27 lines
992 B
TOML
[package]
|
|
name = "bevy_scene"
|
|
version = "0.8.0-dev"
|
|
edition = "2021"
|
|
description = "Provides scene functionality for Bevy Engine"
|
|
homepage = "https://bevyengine.org"
|
|
repository = "https://github.com/bevyengine/bevy"
|
|
license = "MIT OR Apache-2.0"
|
|
keywords = ["bevy"]
|
|
|
|
[dependencies]
|
|
# bevy
|
|
bevy_app = { path = "../bevy_app", version = "0.8.0-dev" }
|
|
bevy_asset = { path = "../bevy_asset", version = "0.8.0-dev" }
|
|
bevy_derive = { path = "../bevy_derive", version = "0.8.0-dev" }
|
|
bevy_ecs = { path = "../bevy_ecs", version = "0.8.0-dev" }
|
|
bevy_reflect = { path = "../bevy_reflect", version = "0.8.0-dev", features = ["bevy"] }
|
|
bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.8.0-dev" }
|
|
bevy_transform = { path = "../bevy_transform", version = "0.8.0-dev" }
|
|
bevy_utils = { path = "../bevy_utils", version = "0.8.0-dev" }
|
|
|
|
# other
|
|
serde = { version = "1.0", features = ["derive"] }
|
|
ron = "0.7.0"
|
|
uuid = { version = "1.1", features = ["v4", "serde"] }
|
|
anyhow = "1.0.4"
|
|
thiserror = "1.0"
|