Skip to content

Conversation

@mockersf
Copy link
Member

@mockersf mockersf commented Sep 27, 2025

Objective

Solution

  • Add a dev plugin that can move the camera
  • Add plumbing to CI testing to be able to move the camera and control screen recording
  • Demo can be configured in code or in a configuration file

Testing

  • Add to an example:
let fps = 120; // FPS for the example on your computer

[...]

// Before `DefaultPlugins`:
        .insert_resource(CiTestingConfig {
            events: vec![
                CiTestingEventOnFrame(fps * 1, ci_testing::CiTestingEvent::StartScreenRecording),
                {
                    let transform = Transform::from_xyz(0.7, 0.7, -1.0)
                        .looking_at(Vec3::new(0.0, 0.3, 0.0), Vec3::Y);
                    CiTestingEventOnFrame(
                        fps * 6,
                        ci_testing::CiTestingEvent::MoveCamera {
                            translation: transform.translation,
                            rotation: transform.rotation,
                        },
                    )
                },
                {
                    let transform = Transform::from_xyz(-0.7, 0.7, -1.0)
                        .looking_at(Vec3::new(0.0, 0.3, 0.0), Vec3::Y);
                    CiTestingEventOnFrame(
                        fps * 11,
                        ci_testing::CiTestingEvent::MoveCamera {
                            translation: transform.translation,
                            rotation: transform.rotation,
                        },
                    )
                },
                {
                    let transform = Transform::from_xyz(-0.7, 0.7, 1.0)
                        .looking_at(Vec3::new(0.0, 0.3, 0.0), Vec3::Y);
                    CiTestingEventOnFrame(
                        fps * 16,
                        ci_testing::CiTestingEvent::MoveCamera {
                            translation: transform.translation,
                            rotation: transform.rotation,
                        },
                    )
                },
                {
                    let transform = Transform::from_xyz(0.7, 0.7, 1.0)
                        .looking_at(Vec3::new(0.0, 0.3, 0.0), Vec3::Y);
                    CiTestingEventOnFrame(
                        fps * 21,
                        ci_testing::CiTestingEvent::MoveCamera {
                            translation: transform.translation,
                            rotation: transform.rotation,
                        },
                    )
                },
                CiTestingEventOnFrame(fps * 26, ci_testing::CiTestingEvent::StopScreenRecording),
            ],
            ..default()
        })
  • Run the example with --features bevy_internal/screenrecording,bevy_ci_testing
  • Lay back, enjoy your demo recording

Showcase

load_gltf-1758980570053.h264.mp4

@alice-i-cecile alice-i-cecile added C-Feature A new feature, making something new possible A-Dev-Tools Tools used to debug Bevy applications. S-Needs-Review Needs reviewer attention (from anyone!) to move forward M-Release-Note Work that should be called out in the blog due to impact labels Sep 28, 2025
@github-actions
Copy link
Contributor

It looks like your PR has been selected for a highlight in the next release blog post, but you didn't provide a release note.

Please review the instructions for writing release notes, then expand or revise the content in the release notes directory to showcase your changes.

@alice-i-cecile alice-i-cecile added this to the 0.18 milestone Sep 28, 2025
@JMS55 JMS55 modified the milestones: 0.18, 0.19 Dec 13, 2025
@mockersf mockersf force-pushed the easy-demo-recording branch from ebdbb85 to 895088f Compare December 15, 2025 01:57
@mockersf mockersf marked this pull request as ready for review December 15, 2025 01:59
translation,
rotation,
} => {
info!("Moved camera at frame {}.", *current_frame);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this log prints whether or not the camera actually moves, so should be a different string (if its meant to convey that the event happened) or moved into the if-let (if its meant to convey the component insertion happened)

query.0.translation.smooth_nudge(
&target.translation,
decay_rate,
time.delta_secs(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regular time delta_secs will always be 0 when the recording is running I think.

@ChristopherBiscardi
Copy link
Contributor

recording works, but camera movement only happens after the recording is over.

animated_mesh-1765768288043.h264.mp4

@mockersf
Copy link
Member Author

moved the camera movement system to PostUpdate so that it happens after any update done by the user, in this case the time update done by the recording

that fixes movements during recording

@ChristopherBiscardi
Copy link
Contributor

nice, working now. These two are with CI-driven camera control:

animated_mesh-1765795452775.h264.mp4
shader_material_screenspace_texture-1765795851787.h264.mp4

and this one is with application-drive camera movement in PostUpdate:

shader_material_screenspace_texture-1765796030791.h264.mp4

Copy link
Contributor

@ChristopherBiscardi ChristopherBiscardi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. CI recording is so coooool.

@ChristopherBiscardi ChristopherBiscardi modified the milestones: 0.19, 0.18 Dec 15, 2025
@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Dec 15, 2025
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Dev-Tools Tools used to debug Bevy applications. C-Feature A new feature, making something new possible M-Release-Note Work that should be called out in the blog due to impact S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants