Page 1 of 1

Motion sensing?

PostPosted: Mon Dec 07, 2009 11:13 pm
by StephenAlverez
I am working on a motion sensing sentry but I don't want to use attraction like in the old ones, so I put together this rif-raf senser. the problem is that I would like advice on a script that detects motion. This here detects anything, so naturaly, it detects the ground (when on a turret) and doesn't do what needs to be done.

Rating: rated 5
Filesize: 8.55 kB
Comments: 0
Ratings: 1
download

Re: Motion sensing?

PostPosted: Tue Dec 08, 2009 3:54 am
by Mystery
I've found lasers work a lot better when they are visible. Invisible laser simply don't exist therefore they are useless. Your also going to want much more accurate angles. The first step is to make the lasers on a 15 degree interval. The Variable will equal the angle of the laser on collide. The senser will need to be stationary but the turret will need some scripts to make is align with the angle of the variable. An easy way to do this is with a handy if statement and a couple of springs
Code: Select all
scene.my.s0 (top spring length)
scene.my.s1 (bottem Spring length)
{scene.my.follow == 15}?{scene.my.s0 = 1.234; scene.my.s1 = 0.231}:{}

Work out the required spring length for each angle and adjust accordingly.

Re: Motion sensing?

PostPosted: Tue Dec 08, 2009 1:06 pm
by StephenAlverez
Thanks, I have never thought of it like that. The laser actually isn't invisible, it's just blue. You can see it pass over clouds. When you say "the angle of the laser on collide" do you mean, the laser angle or the angle of the laser compared to whatever its hitting?

Re: Motion sensing?

PostPosted: Wed Dec 09, 2009 4:40 am
by Mystery
Say the laser is at a 15 degree slant, that's the angle of the laser so the sentry should match that angle.

Re: Motion sensing?

PostPosted: Wed Dec 09, 2009 3:04 pm
by StephenAlverez
Then what should I do with the two springs?
The Variable will equal the angle of the laser on collide
Which variable? As you can see I can't really use Thyme.

Re: Motion sensing?

PostPosted: Thu Dec 10, 2009 3:57 am
by Dadasas
Go to the spring menu and for length put {Whatever He Is Asking} .
Ps. Do not worry if you do not know thyme now , It took me a while to learn it. :thumbup:

Re: Motion sensing?

PostPosted: Thu Dec 10, 2009 1:10 pm
by StephenAlverez
I have put the variable in the spring length, but I don't get why there is no script determining the length of the springs other than this

{scene.my.follow == 15}?{scene.my.s0 = 1.234; scene.my.s1 = 0.231}:{}

which is more like a aiming or not-aiming statment

Re: Motion sensing?

PostPosted: Thu Dec 10, 2009 11:05 pm
by Dadasas
I played with your scene and I made a hinge on the right side of the sensor and in the script menu motor speed, I put {scene.my.follow}, then it worked how I thought you meant it should. :)

Re: Motion sensing?

PostPosted: Fri Dec 11, 2009 12:56 am
by StephenAlverez
Oh, I know that that thing up there works, but when used, it points at the ground. That is why I would like to find a motion sensing device, if it used a code like in other programs (anyone know of scratch?) and not thyme I would put in something like

if
(x1)-(x2)>0
then
(motor speed) = 5

that would be the first statment then

if
(x1)-(x2)<0
then
(motor speed) = -5

would be the second, and everything would be howdy-doody!