new weapon: laser
Laser component: a raycast with reflection off objects.
- [x] laser render and raycast
- [x] reflection
- [ ] albedo
- [x] damage
- [ ] asteroid slicing: laser cuts polygon at intersection.
- [x] refraction: GLASSTEROIDS!!!!! (eg: where n1 = 1 (vacuum) and n2 = 1.5 (glass))
- [ ] internal reflection!
- [x] tracktorbeam: push/pull laser? (apply force at raycast point of contact)
- [x] move tracktorbeam laser ability into own component purchasable at space station
- [ ] #50
- [x] player can cycle through current equipped weapon/tool: cannon, laser
Asteroid could be given a reflective index (albedo) from [0 to 1] Where 0 does not reflect, and 1 reflects 100% of the beam. 0.5 would reflect 50% of the beam, beam dims accordingly.
Asteroid heats up with laser exposure, based on % not reflected?


http://www.iforce2d.net/b2dtut/raycasting
https://asawicki.info/news_1301_reflect_and_refract_functions.html
https://phet.colorado.edu/sims/html/bending-light/latest/bending-light_en.html
reflections and refractions! https://github.com/phetsims/bending-light/blob/main/js/prisms/model/PrismsModel.ts https://github.com/phetsims/bending-light/blob/main/js/common/model/DispersionFunction.ts
https://en.wikipedia.org/wiki/Refractive_index https://en.wikipedia.org/wiki/Sellmeier_equation
https://www.youtube.com/watch?v=KTzGBJPuJwM
ooh pretty colors https://www.youtube.com/watch?v=-VjbYI-eaTQ https://www.youtube.com/watch?v=nVjGzmTURUk
Slice: we get the entry point from the first raycast, but how do we get the exit point for the laser? Answer: perform another raycast! but flip the start and end point, so the ray is cast from the end point of the laser towards the caster. eg:
world.rayCast(callback,p1,p2); //entry point world.rayCast(callback,p2,p1); //exit point
https://www.emanueleferonato.com/2021/04/22/slicing-splitting-and-cutting-html5-box2d-physics-bodies-using-phaser-planck-js-and-polyk/
another simulator https://phydemo.app/ray-optics/simulator/ https://github.com/ricktu288/ray-optics