如何将模型旋转预定义度

问题描述

我想知道如何将模型旋转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) --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