I've tried everything to prevent this from happening, and I've been reading a ton of code and watching videos trying to learn quaternions over days but i still dont think I understand what I can actually do about this problem. I have a first person camera I want to rotate horizontally and vertically, but it innevitably rolls. If this was in Vec3s I could work with it reasonably but that doesnt appear to be an option, another engine let me lock the axis of rotation but that is also not an option, and in other engines i just used parenting to solve the issue but that is also not an option. Here is the code
mut q_camera_transform: Query<&mut Transform, (With<Camera3d>, Without<Player>)>,
mut q_player_transform: Query<&mut Transform, (With<Player>, Without<Camera3d>)>,
mut mouse_motion: EventReader<MouseMotion>,
) {
let mut camera_transform = q_camera_transform.single_mut();
let mut player_transform = q_player_transform.single_mut();
for ev in mouse_motion.iter() { //rewrite
camera_transform.rotate_y(ev.delta.x * TAU * -0.001);
camera_transform.rotate_x(ev.delta.y * TAU * -0.001);
}
println!("{:?}",camera_transform.rotation );
camera_transform.translation = player_transform.translation; // this line is unrelated, just makes the camera attach to the player character
}``` I'm just looking for a line that will negate the roll or somehow lock the axis, ive spent several days on this one issue.
Thank you