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

Behavior in edge cases #124

Closed brandonLi8 closed 4 years ago

brandonLi8 commented 4 years ago

With the new collision engine from #123, I found a few edge case scenarios and was wondering what the desired functionality in these scenarios are.

The first scenario is when a Ball is added to the Pool table on top of another ball.

sample: ![h](https://user-images.githubusercontent.com/42391580/88566953-0456f900-cff4-11ea-8c10-e676f22b2659.gif)

Currently, the Balls pass through each other since the collision engine only deals with when the Balls first touch. One solution could be to "bump" the added ball away using the same method for when Balls are dragged on each other.

The second scenario is when the "Reflecting border" checkbox is turned off, allowing a Ball to escape, then turned back on.

sample (turned off clip area for video purposes): ![g](https://user-images.githubusercontent.com/42391580/88567198-644d9f80-cff4-11ea-9c1d-9128736d9445.gif)

Similarly, the collision engine only detects collisions that happen when the Ball first collides with the wall, so this "collision" isn't detected (and it technically isn't a collision either). One solution could be to translate all the Balls inwards if they are out of bounds when the reflecting border is turned back on.

arouinfar commented 4 years ago

Good questions @brandonLi8. I think the current behavior is fine in both cases.

The first scenario is when a Ball is added to the Pool table on top of another ball.

I will make a note of this in the Teacher Tips.

The second scenario is when the "Reflecting border" checkbox is turned off, allowing a Ball to escape, then turned back on.

The behavior in the gif looks really natural to me.