Motion sensing?

About advanced scenes, and the Thyme scripting language used in Algodoo.

Motion sensing?

Postby StephenAlverez » Mon Dec 07, 2009 11:13 pm

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
I am Alpha and Omega, the beggining and the end.

Image
User avatar
StephenAlverez
 
Posts: 164
Joined: Wed Sep 30, 2009 2:46 am
Location: Vermont

Re: Motion sensing?

Postby Mystery » Tue Dec 08, 2009 3:54 am

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.
User avatar
Mystery
 
Posts: 2802
Joined: Thu Sep 03, 2009 1:16 pm
Location: Southern Australia

Re: Motion sensing?

Postby StephenAlverez » Tue Dec 08, 2009 1:06 pm

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.

Image
User avatar
StephenAlverez
 
Posts: 164
Joined: Wed Sep 30, 2009 2:46 am
Location: Vermont

Re: Motion sensing?

Postby Mystery » Wed Dec 09, 2009 4:40 am

Say the laser is at a 15 degree slant, that's the angle of the laser so the sentry should match that angle.
User avatar
Mystery
 
Posts: 2802
Joined: Thu Sep 03, 2009 1:16 pm
Location: Southern Australia

Re: Motion sensing?

Postby StephenAlverez » Wed Dec 09, 2009 3:04 pm

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.
I am Alpha and Omega, the beggining and the end.

Image
User avatar
StephenAlverez
 
Posts: 164
Joined: Wed Sep 30, 2009 2:46 am
Location: Vermont

Re: Motion sensing?

Postby Dadasas » Thu Dec 10, 2009 3:57 am

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:
User avatar
Dadasas
 
Posts: 46
Joined: Tue Sep 01, 2009 2:03 am

Re: Motion sensing?

Postby StephenAlverez » Thu Dec 10, 2009 1:10 pm

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
I am Alpha and Omega, the beggining and the end.

Image
User avatar
StephenAlverez
 
Posts: 164
Joined: Wed Sep 30, 2009 2:46 am
Location: Vermont

Re: Motion sensing?

Postby Dadasas » Thu Dec 10, 2009 11:05 pm

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. :)
User avatar
Dadasas
 
Posts: 46
Joined: Tue Sep 01, 2009 2:03 am

Re: Motion sensing?

Postby StephenAlverez » Fri Dec 11, 2009 12:56 am

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!
I am Alpha and Omega, the beggining and the end.

Image
User avatar
StephenAlverez
 
Posts: 164
Joined: Wed Sep 30, 2009 2:46 am
Location: Vermont


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 6 guests