Skip to content

Commit

Permalink
Merge pull request #885 from chooblarin/fix-nature-of-code-chp-01
Browse files Browse the repository at this point in the history
Fix nature_of_code/chp_01_vectors example
  • Loading branch information
mitchmindtree authored Jan 17, 2024
2 parents aa49cca + 1bcee75 commit 390613a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl Mover {
// Computer a vector that points from position to mouse
self.acceleration = mouse - self.position;
// Set magnitude of acceleration
self.acceleration = self.acceleration.normalize() * 0.2;
self.acceleration = self.acceleration.normalize_or_zero() * 0.2;
// Velocity chages according to acceleration
self.velocity += self.acceleration;
// Limit the velocity by top_speed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Mover {
// Computer a vector that points from position to mouse
self.acceleration = mouse - self.position;
// Set magnitude of acceleration
self.acceleration = self.acceleration.normalize() * 0.2;
self.acceleration = self.acceleration.normalize_or_zero() * 0.2;
// Velocity chages according to acceleration
self.velocity += self.acceleration;
// Limit the velocity by top_speed
Expand Down

0 comments on commit 390613a

Please sign in to comment.