Lets say we have a laser beam emitter that has a position and an angle (in a 2D world to simplify things). The laser emitted from that emitter will start at that position, and continue heading in the direction of the angle until it intersects with an object (some arbitrary polygon). If that object is reflective, the laser should bounce off the surface that it first intersects. This continues until the laser hits a non-reflective surface.

I guess the problem here can be divided into two problems: finding the first intersection and calculating the new angle from that intersection. I'm not exactly sure how to solve the first problem, but I figure the second one can be solved by finding the angle between the laser and the normal vector (i think that's what it's called) and calculating the new angle using that.

  • \$\begingroup\$ Your first question can't be answered, as you're not really specific about it. Maybe look into "Ray - Line intersection"? Your second question has been answered in this question: gamedev.stackexchange.com/questions/23672/… \$\endgroup\$
    – bummzack
    Feb 22, 2012 at 14:08
  • \$\begingroup\$ I'm sorry, what additional information do I need to specify? I was looking for a general answer. \$\endgroup\$ Feb 22, 2012 at 14:13
  • \$\begingroup\$ I was thinking about something like your edit. It wasn't clear if this is 2D, 3D, if it's vs. lines, polygons, curves, metaballs or whatever :). But nevermind, your edit cleared things up a bit. \$\endgroup\$
    – bummzack
    Feb 22, 2012 at 17:06

1 Answer 1


I think this can be transfered to simple ray casting / ray tracing. You shoot ray, find hit, reflect, find other hit, etc.

The easiest way is brute force. You construct ray (position, direction) and calculate collision with all polygons (you should divide polygons on triangles) in scene. And find closest one. Of course you can't take collision behind rays origin, but only in front of it.

If you find closest intersection, look on material of polygon. If this is reflective, do whole procedure again. If it's not reflective, you are done.

If you have huge scene with lots of polygons and you need to shoot again and again, you can construct some kind of acceleration structure (kD-tree, BVH). But this is more complicated.

If you want more information, just google ray tracing or ray casting. You will find a lot of information.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .