ECS attach bundles #725

Open
opened 2026-07-19 05:27:40 +02:00 by SakulFlee · 0 comments
Owner

Instead of doing something like:

        let camera = ecs.spawn_entity();
        ecs.attach_component(
            &camera,
            CameraDescriptorEcs {
                label: "Default".into(),
                aspect: 16.0 / 9.0,
                fovy: Rad(std::f32::consts::FRAC_PI_4),
                near: 0.1,
                far: 10000.0,
                global_gamma: 2.2,
            },
        )
        .unwrap();
        ecs.attach_component(&camera, Position(Point3::new(-10.0, 0.0, 0.0)))
            .unwrap();
        ecs.attach_component(&camera, Rotation::identity()).unwrap();
        ecs.insert_resource(ActiveCamera(camera));

We should introduce a way of attaching multiple components in one go.
Maybe even a "spawn and attach components" to make it even simpler.

Instead of doing something like: ```rust let camera = ecs.spawn_entity(); ecs.attach_component( &camera, CameraDescriptorEcs { label: "Default".into(), aspect: 16.0 / 9.0, fovy: Rad(std::f32::consts::FRAC_PI_4), near: 0.1, far: 10000.0, global_gamma: 2.2, }, ) .unwrap(); ecs.attach_component(&camera, Position(Point3::new(-10.0, 0.0, 0.0))) .unwrap(); ecs.attach_component(&camera, Rotation::identity()).unwrap(); ecs.insert_resource(ActiveCamera(camera)); ``` We should introduce a way of attaching multiple components in one go. Maybe even a "spawn and attach components" to make it even simpler.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
SakulFlee/Orbital#725
No description provided.