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

How do I reset CFrame.Angles?

Asked by
1GlF 42
5 years ago

So basically, what I'm trying to ask is how am I supposed to "remove" the CFrame.Angles rotation that I put on the part before. So for example I put something like "part.CFrame * CFrame.Angles(0,0.3,0)", but I don't want to do it by doing "part.CFrame * CFrame.Angles(0,-0.3,0)".

0
Try part.CFrame = part.CFrame - part.Orientation. Not sure what it'll do, but I know you can set a variable to the CFrame orientation by doing that, so maybe it works the other way too? Knineteen19 307 — 5y
1
You do CFrame.Angles(0,0,0) Sorukan 240 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Let's save the current rotation first.

local prev_angles = part.Orientation

part.CFrame = part.CFrame * CFrame.Angles(0, math.rad(0.3), 0)

if you want to reset it, you could simply do

part.Orientation = prev_angles

Accept if this helped, thanks.

0
No. That's not what he asked for. He want to reset it. Not save it. So simply do CFrame.Angles(0, 0, 0) ErtyPL 129 — 2y
Ad

Answer this question