How to Rotate this part strait while its on an axis

Hey so im trng to get this part to rotate correctly. By that i mean i dont want it to be tilted on an axis while its rotating like this
https://gyazo.com/9d4777379ee7337688f01771a52aedf6
And this is how it rotates in game
https://gyazo.com/0e7db0731079bc473a41a5f07ff502ce
I want it to look like a tornado, but the mesh was imported with an axis and i was wondering if i can rotate this like a tornado still and if i can what would i have to do? Thanks and if im being vague you can ask questions.
script

	smash.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(0,5,0)
	
	spawn(function()
		while smash do
			smash.CFrame = smash.CFrame * CFrame.Angles(0,math.pi/10,0)
			if game.Workspace:FindFirstChild(player.Name .." 's Smash") then
				smash.Size = smash.Size + Vector3.new(1.5,1,1.5)
			end	
			game:GetService("RunService").Heartbeat:Wait()
		end		
	end)

What is the offset from the imported axis? That is the answer to how to do it here.

1 Like

https://gyazo.com/5d6a57a1a19e870379698de190cf1374

Sorry that doesn’t answer it. I mean, the part isn’t centered on its own axis (visually). How far off it is?

about 12.8,0,-9.8, thats when it looks like its facing the right direction

Alright, you just have to apply that CFrame as an offset after the initial positioning and orienting of the part.

I have an example model (but you can just use a single part)

image

Where the center and primary part is in the center.

If I just rotate it, then it will rotate around the center. Let’s say I want the left most part to be the center of rotation. It is 0,0,3 studs offset. So I apply that as an offset in the code here

local primaryPart = workspace.model.PrimaryPart
local offsetAxis = Vector3.new(0,0,3) -- How far the place we want to rotate from is from the visual center

-- Center of rotation in the world
local centerToRotateAround = Vector3.new(0,20,0)

local testAngle = 0;
while wait() do
	primaryPart.CFrame = CFrame.new(centerToRotateAround) * CFrame.Angles(0,testAngle,math.pi/2) * CFrame.new(offsetAxis)
	
	-- Increase the loop test angle
	testAngle += math.pi/100
end

You end up with this

1 Like

So i think i applied it wrong because it looks like this

https://gyazo.com/72ce68b6dfad8522d5948268c795030c

script

	local offsetAxis = Vector3.new(12.8, 0, -9.8)

	local centerToRotateAround = Vector3.new(0,20,0)

	local testAngle = 0;
	
	spawn(function()
		while smash do
			smash.CFrame = character.HumanoidRootPart.CFrame * CFrame.Angles(0,testAngle,math.pi/2) * CFrame.new(offsetAxis)
			testAngle += math.pi/100	
			if game.Workspace:FindFirstChild(player.Name .." 's Texas Smash Effect") then
				smash.Size = smash.Size + Vector3.new(1.5,1,1.5)
			end	
			game:GetService("RunService").Heartbeat:Wait()
		end		
	end)

The math.pi/2 wasn’t meant to be used in yours, most likely. It’ll flip the part. That was just because, in my example, cylinders face a different axis.

ah, okay what do you suggest i use instead?