phetsims / build-a-nucleus

"Build a Nucleus" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
0 stars 5 forks source link

Particles can sometimes initially move to the wrong spot #190

Closed Nancy-Salpepi closed 1 year ago

Nancy-Salpepi commented 1 year ago

Test device MacBook Air M1 chip

Operating System 13.5.1

Browser Safari 16.6

Problem description For https://github.com/phetsims/qa/issues/977, if I remove the leftmost neutron (or proton) from a filled second level, the remaining 5 neutrons move to the left, leaving the rightmost spot open. Pressing the Add Neutron button, leads to the neutron first moving to the third level before dropping back down to the rightmost spot in the second level.

This also happens within a level. Steps to reproduce below.

Steps to reproduce Scenario 1:

  1. Press the Add Proton and Neutron button 8 times to create Oxygen-16.
  2. Remove the leftmost neutron
  3. Press the Add Neutron button

Scenario 2:

  1. Press the Add Proton and Neutron button 6 times to create Carbon-12
  2. Remove the leftmost neutron.
  3. Repeat step 2
  4. Press the Add Neutron button--the neutron will go to the 5th position first, before sliding over to the 3rd spot.

Visuals

https://github.com/phetsims/build-a-nucleus/assets/87318828/26d8e89e-f373-4375-9d36-9515c3e25c28

Troubleshooting information: !!!!! DO NOT EDIT !!!!! Name: ‪Build a Nucleus‬ URL: https://phet-dev.colorado.edu/html/build-a-nucleus/1.0.0-dev.23/phet/build-a-nucleus_all_phet.html Version: 1.0.0-dev.23 2023-09-12 15:57:17 UTC Features missing: applicationcache, applicationcache, touch Flags: pixelRatioScaling User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Safari/605.1.15 Language: en-US Window: 1317x706 Pixel Ratio: 2/1 WebGL: WebGL 1.0 GLSL: WebGL GLSL ES 1.0 (1.0) Vendor: WebKit (WebKit WebGL) Vertex: attribs: 16 varying: 30 uniform: 1024 Texture: size: 16384 imageUnits: 16 (vertex: 16, combined: 32) Max viewport: 16384x16384 OES_texture_float: true Dependencies JSON: {}
zepumph commented 1 year ago

@Luisav1 committed a nice improvement above to make sure that when reconfiguring the nucleus, that we account for the extra spots that may be changing particle values (either spots being "held" for incoming, or it we lose a particle, updating the particle pointers).

It is working great!

We also added an assertion to double check that we never have duplicates (indicating that we messed up the setting of some particle values).

I had two more questions I wanted to make sure were good:

  1. If you reconfigure during an animation of an incoming particle, will it update to animate to the right particle spot? Yes!
  2. What about if you grab a particle on its way. (is the particle shell position holding going to clear itself?)? We are input disabled when animating an incoming particle, so no chance there.

@Nancy-Salpepi can you give this a spin on main please?

Nancy-Salpepi commented 1 year ago

This is working very nicely on main!