Help with understanding rotation matrix

the title pretty much explains my problem, how do i use the rotation matrix to rotate parts, or how do i get it from a part?

1 Like

A CFrame is a rotation matrix + a position.

There’s an excellent article about it here: CFrames | Documentation - Roblox Creator Hub

And the next article here, which goes into more about the matrix math side of things: CFrames | Documentation - Roblox Creator Hub

CFrame.angles(x, y, z)

Rotating a part is based on position. So, when you rotate anything, you have to multiply the current part’s CFrame with the new rotation.

Rotation is based on degrees or better, radians based on a plane (x, y, z) because we’re in 3D space. On a normal point coordinate system, there’s an x and a y value. X being the left-right horizontal line that crosses through origin (0, 0) and Y being the vertical line that crosses through origin. These vertical lines that together make up the coordinate system are known as planes. Planes are flat and are infinite which is why they’re representing as lines in 2D and equally, in 3D. Rotations will always be rotated on an axis. Even when the axis doesn’t appear to be “straight”, it will be rotated on an axis and on a plane. You can think of each axis as a unit circle (motions are always in a circle) and you can use the unit circle to represent how many degrees of radians from the current rotation you want to go. If you ever get stuck, try to model it out with the visual tools that studio provides.

In Precalc or Trig (?), you learn the concept of vectors (length, magnitude, etc) and the unit circle which provides quick ways to get degrees using pi.

https://developer.roblox.com/en-us/api-reference/datatype/CFrame

NancyPi channel is really good. She has very easy to follow lessons on precalc & trig concepts which I highly recommend before messing with 3D programming. Once you understand the math to it, everything else is quite simple.

1 Like

I’d recommend this series if you really want to dive into the math behind rotation matrices :slight_smile: (at least until ep 5 or so)

4 Likes

That’s an amazing series. I was actually going to recommend that but, I forgot the name of the channel. Thank you for posting. Will help a lot of people struggling out.