SpaceProject icon indicating copy to clipboard operation
SpaceProject copied to clipboard

new weapon: laser

Open 0xDE57 opened this issue 3 years ago • 7 comments

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?

0xDE57 avatar Jan 31 '23 23:01 0xDE57

Image

Image

0xDE57 avatar Apr 06 '23 04:04 0xDE57

http://www.iforce2d.net/b2dtut/raycasting

0xDE57 avatar Apr 11 '23 02:04 0xDE57

https://asawicki.info/news_1301_reflect_and_refract_functions.html

0xDE57 avatar Oct 29 '23 13:10 0xDE57

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

0xDE57 avatar Oct 31 '23 23:10 0xDE57

ooh pretty colors https://www.youtube.com/watch?v=-VjbYI-eaTQ https://www.youtube.com/watch?v=nVjGzmTURUk

0xDE57 avatar Nov 05 '23 06:11 0xDE57

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/

0xDE57 avatar Nov 17 '23 09:11 0xDE57

another simulator https://phydemo.app/ray-optics/simulator/ https://github.com/ricktu288/ray-optics

0xDE57 avatar Mar 23 '24 06:03 0xDE57