# How does math.pi/2 work on CFrames?

I get if this is a more complicated thing to ask, or if its a stupid question, but I want to ask it either way.

For the case of `CFrame`, If you use `math.pi/2` for its Orientation, it would apply a 90 degree rotation. If you remove the `/2` and simply say `math.pi`, it will rotate 180 degrees, However this is just `CFrame` , using it with `Vector3` like maybe `BasePart.Orientation` wouldn’t exactly work, and would only increment a few Degrees instead of making a complete Right Angle, like with `CFrame`, However, that may just be that I’m using it wrong for `Vector3`

The Usage of `math.pi/2` Im referring to:

``````Instance.CFrame = Instance.CFrame * CFrame.Angles(0, math.pi/2, 0) -- makes a 90 degree rotation to the object
``````

printing `math.pi/2` would give you something along the lines of 1.57,and if you convert a number to radians, which in this case we would do `math.rad(90)`, it would return this exact number. While if you change 90 to 180, it will return the “exact” number of `pi`.

``````print(math.rad(90), math.pi/2)
-- same number
``````

Why does this work?
Its sort of something I dont exactly understand, and I was hoping someone could help clear things up.

`Orientation` uses degrees.
`CFrame.Angles` uses radians.

There are 360 degrees in a circle.
There are `math.pi * 2` radians in a circle.
360 degrees = `math.pi * 2` radians

There are 180 degrees in half a circle.
There are `math.pi` radians in half a circle.
180 degrees = `math.pi` radians.

3 Likes

`Basepart.Orientation` and `Basepart.Rotation` are both given in Degrees instead of radiants, and For some reason `Orientation` is in order XYZ instead of the `Rotation` ZYX

Oh, thats why I was confused, Didn’t actually know they used two different Measurements, I guess thats why people use `math.deg()` and `math.rad()` when doing rotations with `CFrame` or `Vector3`.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.