Partの回転アニメーション
スムーズにパーツを回転させます。
- Workspace に Part を1つ追加します。
- Part に Script を追加します。
while true do
script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(0, math.rad(5), 0)
wait()
end
math.ran(5) の「5」は回転角度です。数値を大きくすると早く回転します。
Modelの回転アニメーション
一般的には、複数のパーツを1つにまとめ、Model にすると思います。Model を回転させる場合は下記の通りになります。
- いくつかの Part を追加します。
- それらを Model にします。(すべて選択し、右クリックメニューで Group を実行)
- Model の Anchor をオンにします。
- Model 内の代表的な Part の名前を変更します。(下記の例では「primary」としました)
- Model に Script を追加します。
-- 事前にModelのPropertiesのPrimaryPartに設定するのもOK
script.Parent.PrimaryPart = script.Parent.primary
while true do
script.Parent:SetPrimaryPartCFrame(script.Parent:GetPrimaryPartCFrame() * CFrame.Angles(0, math.rad(5), 0))
wait()
end