How to make a part move as a swirl?

I want to know how can I make a part that can move as a swirl, and have different Y positions?

Like this:

If you can tell me like for example the methods, classes, etc (CFrame, Magnitude, Vectors, etc) that is needed to achieve that, tell me!

Support material:

You can use something known as Bezier paths to achieve the effect of a part moving in a swirl (it is kinda complicated tho, there is probably an easier way but I dont know what it is)

you can read more about them over here: Bézier Curves | Roblox Creator Documentation

1 Like

I did this on the horizontal plane using:

function spiralCoordinates( fraction, maxRadius, maxTheta )
	local radius = maxRadius * fraction
	local theta = maxTheta * fraction
	return math.cos( theta ) * radius, math.sin( theta ) * radius
end

local part = workspace.Part
local startPos = part.Position
local x = 0.1
local z = 0.1
local i = 1
local nextPos
while i < 4 do
	x,z = spiralCoordinates( i, i, 2 * math.pi )
	nextPos = startPos + Vector3.new(x, 0.5, z)
	local newPart = part:Clone()
	newPart.Position = nextPos
	i += 0.1
end

I was trying to make an NPC do dizzy ducks spinning in a spiral but I’ve never quite got it to work properly due to the run anim making it look silly. For your purposes, play with the increment in the loop and change the axis and it should plot what you want.

1 Like

Funni math magic + trigonometry which always makes me rage + epic math functions always help you make something go in a spiral

btw there is a plugin known as bezier paths which you can use to automate the process and do nothing :wink:

Mt main problem was trying to too clever, my ideas exceed my capabilities. I wanted the NPC to spin on the Y axis, then move along the points of the plotted spiral from the code above whilst spinning. It worked OK, but I couldn’t get the walk/run animation to pause whilst the NPC Moved to each point on the spiral. I might give it a bit more thought as I like the look of the effect in my head.

Why do you want an npc to spin in the air lol

Not in the air, but for it to rotate on Y axis, so it would move around an area like a tornado, damaging players as it went.