For over a week now, I’ve been trying to figure this out
I just need to calculate certain points on a circle, but the 350-0 piece is just tripping me up no matter what maths I do. I just can’t figure out the order of nodes, This is currently What I have.
Ive cut all my attempts out and this is the most basic version of what I can get to work without 350-0 working.
Not really sure what the “350-0” (or 360-0) piece is! Did you possibly mean to bring another ss?
Looking at the math right now it looks like
(((-(Z)+W) % 360) + 360) % 360)
We don’t know what your gameplay is like. Let’s start with the first thing -
The bold parts above cancel each other out. Modulo (%) means “Return the remainder,” so if you take a number, say 50, then modulo 360… It’s going to return 50 because 50 is the remainder. If you then add 360 to make it 410, it returns 50 because while the quotient is now 1, 50 is the remainder. In other words, you can just take this part out.
Actually, I’m not sure but I think that might be the issue here, you’re using % as “I want the percentage”, it’s not commonly used in things outside of advanced mathematics.
If you need percentage just use division! Your number divided by 360. So if you did 36/360 you’d get .1 or 10 percent.
So basically I have 4 Points that I need to know when my float is close to, As My dial spins, all the angles work except for 350 degrees to 0 degrees, as the branch won’t see that as less than 10. So I need a way to let the branch know Im less than 10 away on the other side of the circle.
Its really hard to explain.
The modulo bit is because I dont really understand how to calculate a “circle“
Its a dial so As you turn the dial, The float goes from 0 to 360, then hits 360 and goes back to 0
so no matter if I loop counter clockwise or clockwise, It always keeps the value within that 0-360 range.
Then I used a loop to check to see if the float is within 10 to my chosen float values.
which works but not within the ranges of 350 “degrees” to top dead 0. as the branch doesnt see that as less than 10 until I click over 359 back to 0 again at what point its back to being less than 10
Well, if you take the absolute of one number minus another number you will get the difference, so if you take the absolute of your current value minus your target value (4 times as you have 4 targets) and check if that is less than 10, you should have your answer. The only problem being that last value, but just add another check for that as well and you are golden
So, if you want to check 0,60,180 and 300, just add 360 as a check as well and it should be all good