Frame Rotating Around A Point

Hello, I’m extremely confused as to how I would get a frame to rotate around a specific point. In my case it is that I am wanting a frame to rotate around a circle. There is a better explanation following on with the image below. I don’t understand anything about the rotation and I’ve looked through loads of topics and they are either incorrect or don’t follow what I am looking for.

Basically the red line needs to move throughout the circle.

Image:
image

Hi, I would recommend adding an invisible frame over the circle, and parenting the red indicator to this.

Hierarchy would look something like this:
image

Now the UI looks like this (I made the ‘invisible’ part semi transparent)
image

Now when you update the Rotation property of “InvisibleFrame” the red indicator moves as intended
image

I hope I was able to help you and this solved your problem, if you have any follow up questions feel free to ask :slight_smile:

1 Like

That does help but I don’t know how I would make the square rotate itself.
Disregard, I figured that part out using TweenService, thank you very much!

1 Like

@toewi how would I detect when the frame is over a selected part of the circle?

How would I detect when the red frame part is on top of the black part of the circle?

Like This:
image

Easiest way would be if u knew at which rotation the black area starts and ends,

e.g. if the red indicator first touches the black part at rotation = 100 and stops touching at rotation = 130
(you would either eyeball these 2 values or make sure of them whilst setting up the black area)

now you can compare the rotation value of ur invisible rotation frame to the rotation value u know it needs to be in between in order to touch the black part, a simple if statement would suffice:

local Rotation = InvisibleFrame.Rotation
if Rotation > 100 and Rotation < 120 then
    -- red indicator is touching black area of circle 
end

I hope this helps you :slight_smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.