Roblox CFrame from Euler Angles

Posted on

Roblox CFrame or Roblox Coordinate Frame can be described as the data type used to rotate and position 3D objects. This one contains global X, Y, and Z coordinates as well as rotation data for every axis as either the object property or the standalone unit. Another fact is CFrame contain the helpful functions for working with objects in the 3D space.

The term Euler angles means three angles. This term was introduced by a man named Leonhard Euler. The main purpose of it is to describe the orientation of the rigid body with respect to the fixed coordinate system. The Euler angles can also represent the orientation of the mobile frame of reference in physics or the orientation of the general basis in 3-D linear algebra. Apparently, any orientation can be obtained by composing three elemental rotations such as rotations about the axes of the coordinate system.


Roblox CFrame from Euler angles relates to CFrame.lookVector. this one is the unit vector with a magnitude of 1 that points in the direction the CFrame is facing. Actually, the CFrame has three more of those lookVectors, except instead of pointing in the forward direction, they point to the right, top and back of the CFrame. All those verctors, the one positional verctor, and the three directional ones, the right verctor, top vector and back vector, are able to be acquired through a thing called CFrame:components().

Please take a note that the Right, Top, and Back Vectors are not positions of the centers of the faces on the Part. They are named as directions, not positions. Do not forget that the three directional vectors are unit length. Another thing to take a note is that the Position is the same as CFrame.p, and if it is in the Part, then it is also equal to Part.Position.

In fact, the Vector3 is made up of three components, x y and z. All of them determine where the Vector3 is in the game would coordinate grid, that is how the game world defines positions. Basically, changing the x component can cause the Vector3 to move along the right of left axis of the coordinate grid, changing the y component can cause the Vector3 to move along the up or down axis of the coordinate grid, and changing the z component can cause the Vector3 to move along the backward or forward axis of the coordinate grid. If the Vector3 is <0,0,0>, it means the Vector3 is at the origin of the coordinate grid.

When you say something lie CFrame * Vector3, it means that you are telling the Vector3 to take on the coordinate grid defined by the CFrame. In the other words, from now on, either the right or the left axis is defined as the Right Vector of the CFrame. In addition, the up or down axis is defined as the Top Vector of the CFrame, the backward or the forward axis is defined as the Back Vector of the CFrame, and the origin is defined as the Position of the CFrame. Please keep in mind that CFrame0 * CFrame1 does the exact thing, except the orientation part of the CFrame is also transformed.

Leave a Reply

Your email address will not be published. Required fields are marked *