Page 1 of 1

### Lasers

Posted: Mon Sep 14, 2009 10:40 pm
I have no clue how the lasers work, with all the scripts, can somebody make a small tutorial for the lasers? like what you can do with the maxrays, and stuff like that, and how you can calculate a distance with the lasers, i can't find anything to measure with inside the lasers. I tried to measure the maxrays, and fadedist, but that's a static number

Tnx

### Re: Lasers

Posted: Tue Sep 15, 2009 12:18 am
according to some scenes i've seen I think it's like how the app.mousepos variable works, because there are 2 positions on the imaginary grid in algodoo that are being created with lasers and/or oncollide, and then math does the rest in terms of how far the two coordinates are from each other. There's also the extremely simple way to read distance, with multiple lasers at different fadedistances, but that is not perfect and can fill up fast. Those latter choices are mostly for using simple distances with a few lengths measured.

### Re: Lasers

Posted: Tue Sep 15, 2009 8:22 pm
And how do u get the laserpos?
smth like laser.pos? app.mousepos, so app.laserpos? but that won't work, becuz you have more lasers, and what's the poscode for the touchingdistance? I can do the math myself, but i need those 2 codes

### Re: Lasers

Posted: Tue Sep 15, 2009 8:59 pm
To get the position of the laser hit it would be e.geom.pos

### Re: Lasers

Posted: Tue Sep 15, 2009 10:37 pm
Doesn't work, when i do this:

-Define variables
Scene.my.laser = [0,0] or Scene.my.laser = 0
Scene.my.geom = [0,0] or Scene.my.geom = 0

-Change it
Scene.my.laser = e.laser.pos;
Scene.my.geom = e.geom.pos

I putted these codes in the laser collision line.