I have a spinning ball that spins about it's center. I use this code to prevent the angle increasing forever but it has a snag. Whenever I want to change the direction the ball spins it locks up or skips.
If RotAngle >=360 then RotAngle = 0
If RotAngle <=0 then RotAngle = 360
Now the problem is that if any of the balls have an angle of 0 it's changed to 360 and if any have an ang;e of 360 it's changed to 0. This is where the problem is. The two lines of code fight eachother when checking the Max angle.
I thought I would try and leave the angle for one direction and not check it but it just goes in to negative and increases.
What would be the best method to make sure that the positive and negative values never go beyond 360/-360 and bringing them to 0 safely without conflicts?
Thanks :)
If RotAngle >=360 then RotAngle = 0
If RotAngle <=0 then RotAngle = 360
Now the problem is that if any of the balls have an angle of 0 it's changed to 360 and if any have an ang;e of 360 it's changed to 0. This is where the problem is. The two lines of code fight eachother when checking the Max angle.
I thought I would try and leave the angle for one direction and not check it but it just goes in to negative and increases.
What would be the best method to make sure that the positive and negative values never go beyond 360/-360 and bringing them to 0 safely without conflicts?
Thanks :)