Skip to content

Commit

Permalink
Fix camera jitter and improve aim accuracy
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmerlin committed Dec 9, 2023
1 parent a813f62 commit f8e4fb8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/camera_movement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub fn camera_movement_system(

if highest > camera_movement.height {
camera_movement.height += increase;
} else {
} else if highest < camera_movement.height - increase {
camera_movement.height -= increase;
}

Expand Down
7 changes: 3 additions & 4 deletions src/throw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,7 @@ pub fn update_aim_from_mouse_position_system(
mut input: ResMut<Input<KeyCode>>,
) {
let mouse_position = mouse_position.0;
let mut query = query.iter_mut();
if let Some(mut transform) = query.next() {
if let Ok(mut transform) = query.get_single() {
// let force =
// calculate_velocity_for_throw(transform.translation.xy(), mouse_position, aim.direction);
//
Expand All @@ -377,7 +376,7 @@ pub fn update_aim_from_mouse_position_system(

let direct_aim = force_factor > 0.0;

for _ in 0..1000 {
for _ in 0..10000 {
// let switch_aim = input.pressed(KeyCode::ControlLeft);
//
// let angle =
Expand All @@ -393,7 +392,7 @@ pub fn update_aim_from_mouse_position_system(
direct_aim,
);
if shot.is_none() {
min_force += 1.0;
min_force += 0.1;
} else {
break;
}
Expand Down

0 comments on commit f8e4fb8

Please sign in to comment.