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

Collision Detection Approach #11

Closed veillette closed 5 years ago

veillette commented 5 years ago

The two references https://www.toptal.com/game/video-game-physics-part-ii-collision-detection-for-solid-objects https://developer.mozilla.org/en-US/docs/Games/Techniques/2D_collision_detection should be worth reading for the development of collision-lab.

Assigning to @brandonLi8

arouinfar commented 5 years ago

@veillette @brandonLi8 you may want to take a look at gas-properties. That sim has collision detection and response which may be helpful here.

veillette commented 5 years ago

The relevant part in gas-property can be found at https://github.com/phetsims/gas-properties/blob/master/js/common/model/CollisionDetector.js

veillette commented 5 years ago

Because of the number of collisions and the smallness of the balls, gas properties makes some simplifications that are not going to be acceptable in collision-lab

**
   * Detects and handles particle-particle collisions. Particle-particle collision are based solely whether they
   * intersect at their current locations. Is is possible (and acceptable) for two particles to pass through the
   * same point on the way to those location and not collide.
   * @param {Particle[]} particles
   * @param {Object} mutableVectors - set of mutable vectors, see this.mutableVectors in CollisionDetector constructor
   */
veillette commented 5 years ago

This document (referenced in CollisionDetector) on standard rigid-body collision looks very useful http://web.mst.edu/~reflori/be150/Dyn%20Lecture%20Videos/Impact%20Particles%201/Impact%20Particles%201.pdf

veillette commented 5 years ago

We are tracking the development of the algorithm in #23. Closing