如何将模型旋转预定义的角度



我想知道如何在不经过的情况下将模型旋转90度。我正在为一个模型制作动画,我需要知道。

您的问题有点难以理解,但如果您要问如何将模型从脚本旋转90度,下面是如何。

local model = workspace.Model --Get your model
--Make sure you set the PrimaryPart of the model (what you want the model to rotate around)
local PrimaryPartCFrame = model:GetPrimaryPartCFrame() --Get the CFrame of the primary part
local rotation = CFrame.Angles(math.rad(90),0,0) --Create a CFrame rotated 90 degrees on the x axis
local RotatedCFrame = PrimaryPartCFrame * rotation --Creates new rotated cframe that is the primary part rotated 
--(see https://developer.roblox.com/en-us/articles/CFrame-Math-Operations to understand)
model:SetPrimaryPartCFrame(RotatedCFrame) --Rotate the entire model with the new cframe

最新更新