If laser is hitting...
3 posts • Page 1 of 1
If laser is hitting...
Could anyone explain me how to change a variable when a laser is hitting and change it again when it stops hitting an object?
For example I've got a box and a laser when the laser hits the box scene.my.var1 = 0 and when it stops hitting the box scene.my.var1 = 1.
It could be used as a kind of movement sensor or tilting sensor just like here:
For example I've got a box and a laser when the laser hits the box scene.my.var1 = 0 and when it stops hitting the box scene.my.var1 = 1.
It could be used as a kind of movement sensor or tilting sensor just like here:
-
The mask - Posts: 6
- Joined: Sat Jan 23, 2010 6:43 pm
Re: If laser is hitting...
Take a circle and put an offcenter motor in it, put it at +inf strength and 600 rpm, and put that circles on collide to scene.my.var1=1.
I am Alpha and Omega, the beggining and the end.
-
StephenAlverez - Posts: 164
- Joined: Wed Sep 30, 2009 2:46 am
- Location: Vermont
Re: If laser is hitting...
if its motion sensor you want use this in laser
yells when anything tries to pass under it but you cant move it unless you compensate with extra scripting to reevaluate its default pos when moved, another way would be
doesent detect motion but rather what object its hitting, immune to movement as long as the default backstop remains the same
- Code: Select all
(e)=> {e.laser.color==[1,0,0,1]?{e.laser.color=[e.pos(0), e.pos(1), 0, 1]}:{}; e.pos != [e.laser.color(0), e.laser.color(1), 0, 1]?{scene.my.var=1}:{scene.my.var=0} }
yells when anything tries to pass under it but you cant move it unless you compensate with extra scripting to reevaluate its default pos when moved, another way would be
- Code: Select all
(e)=>{check=0; check=e.geom.entityID; check==0?{e.geom.entityID:=1; app.step; app.undo}:{}; e.laser.color==[1,0, 0, 1]?{e.laser.color=[e.geom.entityID, 0, 0, 1]}:{}; e.geom.entityID!=e.laser.color(0)?{scene.my.var=1}:{scene.my.var=0}}
doesent detect motion but rather what object its hitting, immune to movement as long as the default backstop remains the same
- Mr_Stabby
- Posts: 155
- Joined: Wed Dec 16, 2009 12:16 am
3 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 6 guests