# CFrame Vector Chart

I’m having a problem of understanding vector chart right here

This was from CFrame documentation from roblox. As I’m reading it, I couldn’t understand what the “R” stands for. What does that mean? Is this some sort of an actual value number for rotation? How does it work? and How do you use it in scripting?

1 Like

This is simply a rotation matrix which roblox uses to describe rotations within 3D space. These are a bit advanced so I would suggest learning the math and understanding about how Rotation matrix’s translate to 3d rotations.

There is no easy way to fully understand how they work, but the sources below should help. I would recommend having a basic understanding of trigonometric rules and trig.

``````+ Some Sources
https://en.wikipedia.org/wiki/Rotation_matrix
https://www.quora.com/How-do-rotation-matrices-work
``````
1 Like

You don’t need to understand a rotation matrix to actually use roblox’s CFrames. You will need to understand how Euler Angles work and the difference between world space and object space.

Object space is relative to the part, meaning up is the UpVector or top of the part after its rotation is applied.

World space does not respect respect the rotation of the part, up is up regardless of the parts rotation.

I see, thanks for the replies but I thought the R00, R001,R02… was an actual rotation value number. Which confuses me a lot more. But how does that work in a script?

They are rotation values which is calculated within the rotation matrix. I could be wrong, but I believe this is how roblox calculates the rotation of 3D space.

1 Like

In my experience with CFrames for visual effects such as Motor6Ds/Inverse Kinematics you don’t use the numbers individually rather the vectors (.LookVector, .RightVector).

The only time I have seen the numbers used individually from my memory is for serialization in a datastore.

If you are curious on how the numbers work there are resources such as @paswa mentioned and this article by @EgoMoose which replicates a CFrame class in lua and how to convert those numbers into something meaningful and understandable like EulerAngles, haven’t tested it out but I know EgoMoose makes some great CFrame tutorials:

``````function cframe:toEulerAnglesXYZ()
local c = ref[self];
local rx = atan2(-c, c)
local ry = asin(c);
local rz = atan2(-c, c);
return rx, ry, rz;
end
``````

Thanks but man this is beyond the basics. I can’t understand them all at once and I got even more confused the more I looked at it

Yes, it is probably the wrong starting point.

Otherwise another good starting point which is simpler which I also started with was CFrame.fromMatrix which is simpler to understand which explains a CFrame consisting of a RightVector, UpVector, and LookVector that is orthogonal to each other:

This used to be the replacement for CFrame.new(position1, position2) before the newer CFrame.lookAt() which is used all the time in roblox scripting.

Yeah thanks again. I have a question to ask you. What does R00,R01… really means? Is it like rotation number value?

From my understanding R is just a variable which represents the number components of the vector RightVector, UpVector, and LookVector components of a CFrame.

These numbers do not have units as these direction vectors are unitized (length of one). Just like a vector with (0, 1, 2) has the same direction as (0, 2, 4) what matters is these numbers combined such as the right vector which is (R00, R10, R20).

The 00 and 01 notation is just matrix row x column notation.

Even with this explanation, I’m still more confused. It’s very advanced for me to understand how it works and what it means still. Something about this is so confused and very hard to understand.

There’s no need to understand really, unless you’re just trying to satisfy your curiosity. During my time scripting in roblox, I have never once needed to know how the matricies behind CFrames work. If you’re just trying to understand how to use CFrames, this isn’t needed.

Yeah but I still wanna know how those things work.