Motor CW or CCW if/then
3 posts • Page 1 of 1
Motor CW or CCW if/then
Hi, I have a very simple question. Where/how can I change whether a motor turns left or right depending on an input? In this case it's when a variable I have is positive or negative.
Thanks!
Thanks!
- dsengere
- Posts: 12
- Joined: Thu Oct 22, 2009 5:49 pm
Re: Motor CW or CCW if/then
Make two variables. One called Scene.my.motor and the other one called Scene.my.var
Click on the hinge that you want this to affect. Go to its motor script box and put:
In the onCollide/onHitByLaser/onLaserHit put:
- Code: Select all
Scene.my.motor = true; Scene.my.var = 1
Click on the hinge that you want this to affect. Go to its motor script box and put:
- Code: Select all
{Scene.my.motor}
In the onCollide/onHitByLaser/onLaserHit put:
- Code: Select all
Scene.my.var < 0 ? {Scene.my.motor = false} : {Scene.my.motor = true}
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: Motor CW or CCW if/then
I actually had to put scene.my.motor in the CCW box, but thanks!
- dsengere
- Posts: 12
- Joined: Thu Oct 22, 2009 5:49 pm
3 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 12 guests