How to make spiraling rotation?

Is there an efficient way to make a curved effect go around the character in a spiral, basically going around the character? It would be moving and turning, I’m not really sure how to go about doing this. Unlike normal rotation, it would need to be moving around them, but maybe I’m just not seeing something.


image

Like this?

image

--StarterCharacterScripts for simplicity

local player = game.Players.LocalPlayer
local character = script.Parent
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")

local part = Instance.new("Part")
part.Anchored = true
part.CanCollide = false
part.Size = Vector3.new(1,1,5)
part.Parent = workspace

local ORBIT_RADIUS = 5

while true do	
	local currentTime = tick()
	local hrpPosition = humanoidRootPart.Position
	local orbitX, orbitZ = math.cos(currentTime), math.sin(currentTime)
	local partOrbitPositionFromOrigin = Vector3.new(orbitX, 0,orbitZ)*ORBIT_RADIUS
	local partWorldPosition = partOrbitPositionFromOrigin+hrpPosition
	
	local orbitXNew, orbitZNew = math.cos(currentTime+0.1), math.sin(currentTime+0.1)
	local nextOrbitPositionInTheFuture = Vector3.new(orbitXNew, 0,orbitZNew)*ORBIT_RADIUS
	local nextWorldPosition = nextOrbitPositionInTheFuture + hrpPosition
	part.CFrame = CFrame.lookAt(partWorldPosition, nextWorldPosition)
	task.wait()
end
1 Like