I need help with scripting a block that rotates following an arc which is basically a line on a sphere that ends on the exact point where it once began.
To help you understand;
The results I actually want to achieve is a rotating beam, I am not sure if this is possible;
Goldencowboy aka david
You could try having an invisible sphere that would act as the main shape for the spiral then adding beams or guis on the faces for the effect that move
I did this once with the camera in a Viewport Frame when I got bored. Not the cleanest or most readable script, but it serves the purpose well and you could easily adapt this to making a part move in a circle instead of the camera.
local port = script.Parent.ViewportFrame
local rs = game:GetService("RunService")
local camera = Instance.new("Camera", port)
port.CurrentCamera = camera
local camPos = workspace.tiger.PrimaryPart.Position + Vector3.new(0,10,0)
camera.CFrame = CFrame.new(camPos, workspace.tiger.PrimaryPart.Position)
workspace.tiger.Parent = port
local target = port.tiger.ff
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
local radius = 25
local x0 = port.tiger.ff.Position.X
local y0 = port.tiger.ff.Position.Z
local theta = 0
local angle = 0
while true do
local pos = Vector2.new((radius*math.cos(theta)+x0), (radius*math.sin(theta)+y0))
camera.CFrame = CFrame.new(Vector3.new(pos.X, 14, pos.Y), port.tiger.ff.Position)
theta = theta + math.rad(1)
Note that tiger.ff is the center of the model that the camera is rotating around.
The main thing that this script does is calculate each position along the circumference of a circle with radius 25, every 1 degree, then move the camera to that position. The formula used to find the position is X = radius * cos(theta), Y = radius * sin(theta).