I've used Camera2dBundle to import sprites and backgrounds into the scene I'm setting up. But I'm not sure how to move the camera independently of the sprite movements. Basically I don't want the camera to follow the player. I want it to constantly move in a single direction regardless of user input. I've tried:
fn move_camera(mut camera: Query<&mut Transform, With<Camera>>) {
for mut transform in camera.iter_mut() {
transform.translation.x += 5.0;
}
However this moves the player's x position
I see transform is made of these items:
Transform { translation: Vec3(0.0, 0.0, 999.9), rotation: Quat(0.0, 0.0, 0.0, 1.0), scale: Vec3(1.0, 1.0, 1.0) }
Here's how I'm accepting user input:
if keyboard_input.pressed(KeyCode::Right) {
transform.translation.x += 2.0 * 5.0;
transform.rotation = Quat::from_rotation_y(0.0).into();
*atlas = player.run.clone();
Is there a better way to do this? Can I add an item to transform? Or what modification can I make?