Calculating Rotation Around a Single Point

Hello!

I’m currently working on a character customization system and have run into a bit of a problem. I’m trying to allow the player to pan their camera around the preview of their character in a circular motion, but I don’t quite know the exact maths I’d need for such a rotation.

What equation can input a fixed point, radius and angle of rotation and output that point around a circle?

Here’s a quick diagram of what I’m trying to accomplish(trying to find x)

Any help and ideas are welcome, a bit stumped with this one.

x = R * math.cos(A)
y = R * math.sin(A)
X = P + Vector3.new(x, 0, y)
-- (x and y might be switched depending on how your coordinates are set up)

5 Likes

Just went and tested this, worked absolutely brilliantly! You’re a hero, thank you for the information!

1 Like

You could also use CFrames (the lazy way):

(CFrame.new(P) * CFrame.Angles(0, A, 0) + CFrame.new(0, 0, -R)).Position
2 Likes