phetsims / gravity-and-orbits

"Gravity And Orbits" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
12 stars 6 forks source link

Object in launched sim may change orientation if time is stepped back #457

Closed KatieWoe closed 1 year ago

KatieWoe commented 1 year ago

Test device Dell Operating System Win 11 Browser Chrome Problem description For https://github.com/phetsims/qa/issues/838. When a sim is launched, the step back time control is available. However, it "steps back" to the location it was at when launched. If the sim is paused, this should mean nothing happens. However, the orientation of the object is changed. Steps to reproduce

  1. Go to the Model screen and the Planet and Satellite scene
  2. Play the sim briefly
  3. Pause the sim
  4. Launch the sim
  5. In the launched sim, hit the step back button and observe the satellite

Visuals changeorientation

arouinfar commented 1 year ago

Thanks @KatieWoe.

@samreid this looks like a problem with the rotationProperty of the object. It's easiest to observe with the satellite, but it's a general problem.

Here's an example following @KatieWoe's steps to reproduce, but with the PlanetMoonScene.

rotationProperty = -1.92... radians in Studio and the initial configuration of the Standard PhET-iO Wrapper: image

rotationProperty resets to zero when pressing the Restart button in the Standard PhET-iO Wrapper: image

It seems like the rotationProperty is excluded from the state saved by the Restart button, which may explain why the button is enabled by default in the Standard PhET-iO Wrapper. I would expect it to be disabled because the initial state in the wrapper should be identical to the state restored with the Restart button.

arouinfar commented 1 year ago

It seems like the rotationProperty is excluded from the state saved by the Restart button, which may explain why the button is enabled by default in the Standard PhET-iO Wrapper.

I compared to the 1.5 version, and the Restart button is disabled in the Standard PhET-iO Wrapper, as I would expect. However, if you play or step forward to enable the restart button, and then press restart, it will restore a state with the rotationProperty = 0.

samreid commented 1 year ago

Fixed and ready for cherry-pick

KatieWoe commented 1 year ago

This seems fixed in RC.3