Page 1 of 1

Lasers

PostPosted: Mon Sep 14, 2009 10:40 pm
by Jelmerholland
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

PostPosted: Tue Sep 15, 2009 12:18 am
by Ian151
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

PostPosted: Tue Sep 15, 2009 8:22 pm
by Jelmerholland
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

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

Re: Lasers

PostPosted: Tue Sep 15, 2009 10:37 pm
by Jelmerholland
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.

What is wrong? Can somebody please help me? I want to learn to work with lazors... :D

Tnx

Re: Lasers

PostPosted: Tue Sep 15, 2009 10:43 pm
by standardtoaster
Sorry, it is actually e.pos not e.geom.pos

Re: Lasers

PostPosted: Wed Sep 16, 2009 1:32 pm
by Jelmerholland
but thats the pos of the geom? or the laser?
And what's the pos of the laser if that's the geom? becuz you will need both i guess?