Motion sensing?
9 posts • Page 1 of 1
Motion sensing?
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.
I am Alpha and Omega, the beggining and the end.
-
StephenAlverez - Posts: 164
- Joined: Wed Sep 30, 2009 2:46 am
- Location: Vermont
Re: Motion sensing?
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
Work out the required spring length for each angle and adjust accordingly.
- 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.
-
Mystery - Posts: 2802
- Joined: Thu Sep 03, 2009 1:16 pm
- Location: Southern Australia
Re: Motion sensing?
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?
I am Alpha and Omega, the beggining and the end.
-
StephenAlverez - Posts: 164
- Joined: Wed Sep 30, 2009 2:46 am
- Location: Vermont
Re: Motion sensing?
Say the laser is at a 15 degree slant, that's the angle of the laser so the sentry should match that angle.
-
Mystery - Posts: 2802
- Joined: Thu Sep 03, 2009 1:16 pm
- Location: Southern Australia
Re: Motion sensing?
Then what should I do with the two springs?
Which variable? As you can see I can't really use Thyme.The Variable will equal the angle of the laser on collide
I am Alpha and Omega, the beggining and the end.
-
StephenAlverez - Posts: 164
- Joined: Wed Sep 30, 2009 2:46 am
- Location: Vermont
Re: Motion sensing?
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.
Ps. Do not worry if you do not know thyme now , It took me a while to learn it.
-
Dadasas - Posts: 46
- Joined: Tue Sep 01, 2009 2:03 am
Re: Motion sensing?
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
{scene.my.follow == 15}?{scene.my.s0 = 1.234; scene.my.s1 = 0.231}:{}
which is more like a aiming or not-aiming statment
I am Alpha and Omega, the beggining and the end.
-
StephenAlverez - Posts: 164
- Joined: Wed Sep 30, 2009 2:46 am
- Location: Vermont
Re: Motion sensing?
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.
-
Dadasas - Posts: 46
- Joined: Tue Sep 01, 2009 2:03 am
Re: Motion sensing?
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!
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!
I am Alpha and Omega, the beggining and the end.
-
StephenAlverez - Posts: 164
- Joined: Wed Sep 30, 2009 2:46 am
- Location: Vermont
9 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 0 guests