Ok, well... let's say the initial situation is that the circle
(carousel) of items is snapped correctly, i.e. The item the camera
looks at is at the closest distance to the camera. So if we rotate the
carousel left or right the item will start to move away further from
the camera. Let's also have a variable that is the current
carouselRotation, initialized to carouselRotation = 0.
Now as we move the carousel we keep track of how much we rotate, if we
rotate right we add the degrees to carouselRotation, if we rotate left
we subtract from carouselRotation and wrap around when below 0: if
(carouselRotation < 0) carouselRotation += 360   so it's always a
positive value (it's perhaps also wise to subtract 360 when it's
larger than 360)
Assuming the items in the carousel are evenly spread the rotation
between each is 360/10 = 36 degrees (as seen from the center of the
carousel)
Now when we wish to snap we look at the current carouselRotation. We
perform a modulo operation on the carouselRotation as follows:
tSnapRot = carouselRotation % 36
tSnapRotation is always between 0 and 36 (excluding 36) and indicates
how much we have to turn back to get to a snap position.
But remember that we don't always want to rotate back, we may have to
rotate forward if the next item is closer to us. We can check for this
by checking if tSnapRotation > 18, if so then we should rotate forward
by (36-tSnapRotation), if not then we should rotate backward by
tSnapRotation.
Hope this helps you. Let me know.

-- Apprentice

On Jun 6, 5:15 pm, danee987 <[email protected]> wrote:
> No I haven't figured it out and I thank you very very much for answering
> lol. I'm still stuck any way you can help me further? It makes sense what
> you're saying but I don't know how to come to the correct angle. I have 10
> tiles only and that number never changes. It's always 10 tiles. The camera
> doesn't move at all so I guess the angle between the cam and center point of
> the carousel would always be 0 for example. So say I have a tile that is 2
> degrees to one side from being lined up with the camera, my question at this
> point would be what is the formula I can use to have flash first understand
> that its 2 degrees off and to rotate my group 2 degrees in the correct
> direction to reach the center? This is where it all becomes a foggy mess to
> me:/ I'm horrible at math blehh. If you could help me further it would be a
> great help. Thanks
>
> - D

Reply via email to