How to rotate a part around its pivot?

How to rotate a part around its pivot without using hinge constrainst? Via script.

2 Likes

The way I would execute this involves:

  1. Adding a separate transparent part where the pivot point would be
  2. Grouping the two parts as a model
  3. Setting the primary part to the transparent part
  4. Using Model:SetPrimaryPartCFrame to rotate the model

Not sure if there’s a much easier method I’m missing.

1 Like

I also thought about this before but I have a question, can this be animated? If I just animate the Part the Model won’t move

I assume you’re talking about TweenService, I think you can weld the two parts using a Motor6D, and then tween the primary part making sure it’s anchored and the other part isn’t.

1 Like

That’s not exactly what I wanted, but I’ll accept it anyway, it works is what matters. Work smarter not harder haha. Thank you.

1 Like

Here’s a better way.


function rotatePart(part, degrees, axis : Vector3)
	local a = axis.Unit * Vector3.new(math.rad(degrees),math.rad(degrees),math.rad(degrees))
	part:PivotTo(part:GetPivot()*CFrame.Angles(a.X,a.Y,a.Z))
end

for i = 1, 360,5 do 
	wait(.01)
	rotatePart(workspace.Part,5,Vector3.new(0,1,0))
end

https://i.gyazo.com/309ab43d76945a52e5695113f43af19b.mp4

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.