HOME | DD

ssjskipp — Lasers and Mirrors

Published: 2008-10-25 22:39:13 +0000 UTC; Views: 556; Favourites: 5; Downloads: 7
Redirect to original
Description Moved to scraps until I fix it >>.
Okay, fixed.
Okay, j/k, not fixed yet >>.

So, we learned about mirrors in physics (woo~). So, I made this little laser and mirror thinggy.

Each mirror is represented by a vector (The blue lines drawn onto it). I have a bunch pre-placed, but really, they could be added/generated if need be. Also, the laser's starting point is arbitrary. Made a neat function to calculate the laser for X iterations. 25 is default, so here, the laser will bounce 25 times before giving up.

Click + Drag on a mirror or the laser to rotate it. Have...fun? Iunno, just a neat experiment. Perhaps I will do mirrors + light next? Or maybe lights and shadows! WHO KNOWS!!!!
Related content
Comments: 14

MineePhil [2008-10-27 15:15:06 +0000 UTC]

[link]

Thick Laser!

Aside from all the errors that have been pointed out, this is a really nifty thing. You never cease to amaze!

👍: 0 ⏩: 1

ssjskipp In reply to MineePhil [2008-10-27 16:18:07 +0000 UTC]

lol XD, if only it was working, I had a game idea with this engine :3!

👍: 0 ⏩: 0

supermega-me [2008-10-26 15:31:06 +0000 UTC]

despite being messed up (as pointed out above), definitely cool

👍: 0 ⏩: 1

ssjskipp In reply to supermega-me [2008-10-26 19:57:37 +0000 UTC]

Indeed :3. wait 'till it's fixed.

👍: 0 ⏩: 0

lyc [2008-10-26 06:24:00 +0000 UTC]

aye, it's wrong

probably you have the reflection formula right (it's easily found on the net), but your normals are borked; try using the absolute value of the dot product in the reflection computation vector.

👍: 0 ⏩: 1

ssjskipp In reply to lyc [2008-10-26 19:57:25 +0000 UTC]

Well, the normals are correct, like, I can draw them on to show you (it picks the correct normal an all, right direction and everything), but it's not quite right with what to do after. I suspect my error is somewhere else in it.

👍: 0 ⏩: 0

psykopath [2008-10-26 03:22:59 +0000 UTC]

Also easily demonstrated by shooting the left mirror. Should go up, but it comes almost straight back.

👍: 0 ⏩: 1

ssjskipp In reply to psykopath [2008-10-26 19:56:41 +0000 UTC]

Indeed, the normals work, but there's a screw up somewhere there...

👍: 0 ⏩: 0

psykopath [2008-10-26 03:20:12 +0000 UTC]

Yeah, as *wonderwhy-ER said, your angle's don't seem right. Screenshot: [link] Circle around the area, green line is what I would expect.

👍: 0 ⏩: 1

ssjskipp In reply to psykopath [2008-10-26 19:56:21 +0000 UTC]

Aye, I know >>

👍: 0 ⏩: 0

wonderwhy-ER [2008-10-25 23:03:26 +0000 UTC]

Hmm something is wrong no? Or your material is nor really a mirror? I mean that for mirror laser should bounce with same angle it flew in but in your case it is not...

👍: 0 ⏩: 1

ssjskipp In reply to wonderwhy-ER [2008-10-26 19:56:01 +0000 UTC]

It bounces off with the angle between light and normal, since the mirror is a flat surface. I messed up the math a bit, and submitted it once I got it to bounce more than once >>. Fixing as we speak.

👍: 0 ⏩: 2

wonderwhy-ER In reply to ssjskipp [2008-10-26 23:35:10 +0000 UTC]

Hmm still little bit wrong for mirrors in Centr-Top and Bottom-Right

👍: 0 ⏩: 0

wonderwhy-ER In reply to ssjskipp [2008-10-26 21:03:39 +0000 UTC]

Yeah that what I meant Psyhopath showed with screen shot thought. that's what I should have done

👍: 0 ⏩: 0