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

What's wrong with this?

Asked by
blowup999 659 Moderation Voter
9 years ago

I'm trying to make the rotation of something (90,0,0) and I can't use Part.Rotation so when I do this it makes the rotation 116.62 instead of 90 why won't it make the rotation 90?

part.CFrame=part.CFrame*CFrame.fromEulerAnglesXYZ(90,0,0)

1 answer

Log in to vote
3
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

Use CFrame.Angles instead, it's the same method, but with a shorter name.


CFrame.Angles uses radians, not degrees. There are 2 pi (apprx. 6.28) radians in a full revolution (as opposed to 360 degrees).

The reason for this comes from math. Using radians makes calculus much neater (e.g., d/dx sinx(x) = cos(x)) and makes other identities nice (e^(i * x) = cos(x) + i * sin(x))

You can convert between radians and degrees using math.deg and math.rad, e.g.,

* CFrame.Angles( math.rad( 90 ), 0, 0 )

which happens to be * CFrame.Angles( math.pi / 2, 0, 0).

0
Wow, I feel like this is a question I answered a while ago. I don't know if it's the same asker or not. xD Tkdriverx 514 — 9y
0
It's not blowup999 659 — 9y
Ad

Answer this question