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

How do I rotate a model with a Cframe?

Asked by 6 years ago

I used

model :SetPrimarayPartCFrame(CFrame.new(45, math.deg(0) 0)
print ("Rotated")

It moved the model to another position instead of just rotating it

1 answer

Log in to vote
2
Answered by 6 years ago

You should look at the contents of what CFrame actually is: http://wiki.roblox.com/index.php?title=CFrame

The first three values you have in your CFrame.new are a Vector3 value for position.

In order to change the angles you would need to multiply your CFrame (keeping the position) by EulerAngles.

model:SetPrimaryPartCFrame(model.PrimaryPart.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(45), 0, 0))
Ad

Answer this question