Rotation passes a point

BlitzMax Forums/MiniB3D Module/Rotation passes a point

ima747(Posted 2010) [#1]
I have a sprite that's a circle, think wheel of fortune wheel, and when a given point goes past a certain angle I need to do things, the point is attached to the wheel. I can't get my head around a good way to detect that if the wheel turns a certain amount, will that cause the point to cross the target...

Anyone got an idea so my brain can stop exploding?


Sledge(Posted 2010) [#2]
The angle the point is at in relation to the angle of the wheel will be constant if it is attached. To see if it falls within a certain range, mod it and see!

EDIT: Oh, I see there are a couple of gotchas, namely that positive roll rotations seem to turn entities negatively and that EntityRoll() can actually be a negative. Here's a (long-winded!) solution...



The trick is to get the point's global angle within the normal 0-359 degree range and then specify that you are checking it against values supplied in a clockwise direction (although, of course, you could just as easily go with anticlockwise as long as you pick one and stick to it, but that's more typing!) That way you can tell which portion to check and whether it transcends zero.


ima747(Posted 2010) [#3]
Thanks sledge! I think I figured out what i need, your code will come in quite handy when I get a little further.