Script bug
4 posts • Page 1 of 1
Script bug
I made an angle calculating formula based off 2 lasers hitting a box from either side, the box has 3 lasers pointed at it (2 for measuring angle 1 for spawning) and it can tell the difference between them, the problem is that this particular part of the script doesent really work
it goes through the part and in the end has no idea what anglez is, if i put scene.my.var=anglez inside the brackets it works perfectly but anything thats outside that if statement cant get access to anglez variable, this is driving me nuts since i dont see anything wrong with it
- Code: Select all
xdiff = textcolor(2) - textcolor(0);
ydiff = textcolor(1) - textcolor(3);
scene.my.var = anglez;
xdiff > 0 ?
{ ydiff = ydiff + 0.03125; anglez = ydiff / 0.0625 * 180 - 90 } :
{ ydiff = ydiff + 0.03125; anglez = 270 - ydiff / 0.0625 * 180 };
it goes through the part and in the end has no idea what anglez is, if i put scene.my.var=anglez inside the brackets it works perfectly but anything thats outside that if statement cant get access to anglez variable, this is driving me nuts since i dont see anything wrong with it
- Mr_Stabby
- Posts: 155
- Joined: Wed Dec 16, 2009 12:16 am
Re: Script bug
Why don't you just use e.normal to measure the angle? you will only need 1 laser for it and a small code.
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: Script bug
ah wasnt aware of the e.normal attributes, that works too ty
- Mr_Stabby
- Posts: 155
- Joined: Wed Dec 16, 2009 12:16 am
Re: Script bug
you can use trigonometric functions to get the angle from it. if you already knew this how did you make it otherwise?
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
4 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 5 guests