Hello, I would like to know how I am able to use the CFrame rotation smoothly. So I am able to rotate an object smoothly.
Here was my experiment but it was a failure:
while wait() do script.Parent.CFrame = CFrame.new(script.Parent.CFrame) * CFrame.Angles(0,0,script.Parent.Rotation.Z + 1) end
The parameter to CFrame.new(pos)
is a position, which is a Vector3
, not a CFrame. Use
either
CFrame.new( script.Parent.CFrame.p )
or
CFrame.new( script.Parent.Position )
You probably want to rotate by less than 1. CFrame.Angles
parameters, unlike the Rotation
property, is measured in radians not degrees. Though it's probably better that you just keep track of the angle rather than read the property as you are doing:
local angle = 0 while wait() do angle = angle + 0.1 script.Parent.CFrame = CFrame.new(script.Parent.Position) * CFrame.Angles(0, 0, angle) end
0.1 radians / .03seconds
is 3.33 radians / second
or approximately one revolution per second.