phetsims / collision-lab

"Collision Lab" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
6 stars 4 forks source link

Ball can escape reflecting border if size is changed near the edge #189

Closed arouinfar closed 3 years ago

arouinfar commented 3 years ago

Basically this is #167, but instead of changing the mass near a border, toggle Constant Size.

An easy way to demonstrate the bug:

  1. Explore 1D, 1 Ball, Mass 3.00 kg, Constant Size on

  2. Press play, and when the ball is near the reflecting border, uncheck Constant Size image

  3. Part of the ball is now out-of-bounds, and will escape the Reflecting Border image

jonathanolson commented 3 years ago

Now bumping balls away from everything when constantSize is toggled. Does this look good?

arouinfar commented 3 years ago

Looks good in master @jonathanolson

arouinfar commented 3 years ago

Actually, something's not quite right @jonathanolson.

  1. Explore 2D, 4 Balls, Constant Size on
  2. Drag balls so they are close to one another image
  3. Turn off constant size, and the balls repel (all good) image
  4. Reset the observation window and the balls clump together. Looks like the new positions were not saved. image
jonathanolson commented 3 years ago

We're now explicitly saving the positions in that case with the above commit. Can you verify that this fixes it? It worked for me.

arouinfar commented 3 years ago

Looks good @jonathanolson!