Reflecting laser beams off surfaces

  • R0J0hound thank you so much, that really got me going, such an elegant solution!

    You are really talented!

  • R0J0hound thanks, good example, like all your works.

  • R0J0hound[ how does this process works? could you please attach a detailed documentation on your algorithm?

  • Ken95

    The process? It's basically just finding the intersection between lines a bunch of times. The objects have a border made up of lines and the ray is a line. You can just place the lines of the objects manually or use math to place them.

    It finds all the lines that intersect the ray, then uses the intersection closest to the start of the ray. From there you can calculate the normal of where the lines intersect and in turn calculate the reflection angle. Then it's just a matter of setting the ray to be from the intersection going at the reflection angle and repeating the process a number of times.

    The calculating of the line intersections and reflection angles is easily found in a search engine.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • dropbox.com/s/cx2l2ex8p31n6 ... .capx?dl=0

    here is my capx mr r0j0hound.

    there are two laser machines that produces the laser beam.

    the problem is that only one of the laser machines produces the beams.

    would you please fix my event sheet so that it produces 2 laser beam with each has its own reflecting properties. O would be glad if i fixed that problem. Thanks in advance

  • Ken95

    The process? It's basically just finding the intersection between lines a bunch of times. The objects have a border made up of lines and the ray is a line. You can just place the lines of the objects manually or use math to place them.

    It finds all the lines that intersect the ray, then uses the intersection closest to the start of the ray. From there you can calculate the normal of where the lines intersect and in turn calculate the reflection angle. Then it's just a matter of setting the ray to be from the intersection going at the reflection angle and repeating the process a number of times.

    The calculating of the line intersections and reflection angles is easily found in a search engine.

    dropbox.com/s/cx2l2ex8p31n66t/JailBreak.capx

    here is my capx mr r0j0hound. dropbox.com/s/cx2l2ex8p31n6 ... .capx?dl=0

    there are two laser machines that produces the laser beam.

    the problem is that only one of the laser machines produces the beams.

    would you please fix my event sheet so that it produces 2 laser beam with each has its own reflecting properties. O would be glad if i fixed that problem. Thanks in advance

  • Ken95

    If you are trying to attract the attention of a user, you need to preface the user name with the "@" sign, as I have done to attract your attention.

  • Ken95

    I won't have time to look at your capx, but if it's only working for one laser then you need to repeat the actions for the other lasers. A loop would be useful.

  • R0J0hound

    I have already done it but the produced laser will be on the exact same place as the first one

  • True. You need to change the Ray for the second iteration. Probably a "for each laser" instead of the repeat so that each Ray could be used.

    As a rough overview it's kind of like this:

    For each laser

    ---"set Ray" to laser

    --- for each wall

    ------ "cast to" wall

  • Hello , 2018 and someone can re-post capx here ! I really want to see it

  • R0J0hound can you please reupload the capx, the link you posted is dead.

  • link updated

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)