Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is my use of CFrame.Angles() defaulting to a random position?

I'm currently making something where a player can press R and a part gets rotated by 90 degrees, but for some reason it always defaults to some other rotation (270 degrees changes to about 10, 90 degrees changes to about 63, etc). This is essentially what I am using right now:

--NOTE: position is a Vector3 and rotation is an integer
CFrame.new(position+Vector3.new(2,2,2))*CFrame.Angles(0,rotation,0)

The position itself works fine, but the angle is never correct. Any help would be appreciated, thanks!

1 comment

0

whats the value of rotation?

1 answer

✓ Accepted answer

CFrame.Angles' three parameters are expected to be in radians, not degrees. This can be remedied rather easily:

CFrame.new(position+Vector3.new(2,2,2))*CFrame.Angles(0,math.rad(rotation),0)

Hope this helped.

More on CFrame.Angles & math.rad.

1 comment

0

Okay, thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.