Rotate model of 360 degree

Hey,
I’m trying to make this smooth animation of the model rotating on itself until going back to the start rotation.

I tried searching online for help, but idk what rads are and idk how to apply them to this.

local PPCF = Modello:GetPrimaryPartCFrame()
	for i = 0,360 do
		Modello:SetPrimaryPartCFrame(PPCF.Position, Vector3.new(0,i,90))
		wait(0.1)
	end
	Modello:SetPrimaryPartCFrame(PPCF.Position, Vector3.new(0,0,90))

Thank you!

4 Likes

Rotating a model would be far more smoother using TweenService. Colbert2677 has made a really good tutorial on how to tween models here. To make it loop indefinitely, you’d use a tween completed event.

Example of tweening indefinately:

local tweenService = game:GetService("TweenService")
local spinTween = tweenService:Create(parameters) --set up a full rotation here

local function tweenFunction()
	spinTween:Play()
end

tweenFunction()
spinTween.Completed:Connect(tweenFunction)
3 Likes

When trying to use Rotations with CFrame, you would have to know about Radians (or rad) to know how to rotate the object Correctly.

Radians, putting it simply, is just another Unit of Angles that is commonly found in math in places like Trigononmetry, which would play a big role in helping you understand what exactly it is when trying to measure a Circle, On the Surface it looks pretty complicated, but its not that hard to understand, and I’ll show you a Couple of things that would help you use them.

In a Full Circle, The Angle in Degrees that it will Contain will be 360, but in Radians it will be radians, But what is a Radian? A radian is an Measurement of Angle that is roughly equal to 57.3 degrees, we get this number by dividing 360 by , with the resultant being 57.2957795131, Which when rounded up, will be equal to 57.3

If you want more Info about Radians and such, I Recommend looking into it deeper as I have a very basic understanding of it, here is one link that might help explain more on the subject.

But, When using Radians, you have to first understand π, or pi, which is roughly 3.141592653, and its often just shortened to just 3.14, In the case of rotations, its called “pi radians”, it is equal to 180 degrees, with that info you can look at this, which will shows you the Rotation in Radians and degrees, this is a very basic however.

π/4 = 45° (pi/4 radians is equal to 45 degrees (1/8 of a circle) )
π/2 = 90° (pi/2 radians is equal to 90 degrees (1/4 of a circle) )
1π = 180° (pi radians is equal to 180 degrees (half a Circle) )
1.5π = 270° (1.5pi radians is equal to 270 degrees (3/4 of a circle) )
2π = 360° (2pi radians is equal to 360 degrees (full Circle) )

There are math functions that will help convert Degree’s to Radian’s and Radian’s to Degree’s, known as math.rad, and math.deg, math.rad is the Inverse of math.deg, and math.deg is the Inverse of math.rad where they each undo each other, these would be their formulas:

rad = x(180/π)
deg = x(π/180)
or in code:

rad = x * (180/math.pi)
deg = x * (math.pi/180)
6 Likes

Thank you both! @PR_0B @DasKairo
You really helped me

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