Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to you rotate a model in a certain direction?

Asked by 8 years ago

This is what I've tested

local cframe= CFrame.new(model.PrimaryPart.Position) -- CFrame with default rotation

model:SetPrimaryPartCFrame(cframe * CFrame.new(0, math.rad(90), 0))

and this

local Model = workspace.Model -- Replace this with your model.

Model:SetPrimaryPartCFrame(CFrame.new(0, math.deg(90), 0))

Both of them rotated my model 180 degrees and it did even if I put somthing else instead of 90

1 answer

Log in to vote
1
Answered by 8 years ago
Edited 8 years ago

The problem is that you are setting a new CFrame and not using the current CFrame of the model, you have also use CFrame.new instead of CFrame.Angles. You also need to be using radians with CFrame.Angles.

local Model = workspace.Model 
-- using the current CFrame rotate the CFrame by 90 degrees
Model:SetPrimaryPartCFrame(Model:GetPrimaryPartCFrame() * CFrame.Angles(0, math.rad(90), 0))

I hope this helps.

0
Yes, but I want to set the rotation kokungen12345 15 — 8y
Ad

Answer this question