I’m trying to make this frame rotate around the center, for when the player gets hurt and there’s a directional indication of where it came from. However, I’m having trouble with making the frame rotate around the center of the screen.
This, while properly rotating the frame, makes it rotate on its edge and not around the center of the screen. Anyway to make it rotate around the center with a position offset?
local targetVector = camera.CFrame:ToObjectSpace(workspace.Part.CFrame).p
local angle = math.atan2(targetVector.X, -targetVector.Z)
hurtImage.Rotation = math.deg(angle)
local dirX = math.cos(angle)
local dirY = math.sin(angle)
hurtImage.Position = originPos + UDim2.new(0, dirX * distance, 0, dirY * distance)