What is the difference between CFrame.RightVector and CFrame.XVector?

Hello
What is the difference between CFrame.RightVector and CFrame.XVector?
No matter how I rotate my object, they always return the same?

How can I get the CFrame’s “LeftVector”?

Thanks

XVector is an normal vector like RightVector, to get left vector, u just subtract

CFrame.RightVector*-3 --returns LeftVector
2 Likes

You almost never want the XYZVector unless you’re doing some real fiddly matrix math.

The left vector is just -cf.RightVector.

1 Like

Thanks
I still cannot understand, however, why I do get the same values for RightVector and XVector?

image

print(workspace.GreenPart.CFrame.RightVector)
print(workspace.GreenPart.CFrame.XVector)

image

That’s interesting. Could you also

print(workspace.GreenPart.CFrame:GetComponents())

along with the other two?

edit: and can you say what the Orientation is?

this is the result from GetComponents:

21 7.499999046325684 4.000005722045898 0.35355353355407715 0.926776647567749 0.12682637572288513 -0.7071068286895752 0.3535534143447876 -0.6123725771903992 -0.6123725175857544 0.12682673335075378 0.7803301811218262

Orientation is
37.761, 9.232, -63.435

Hm. There’s a bug with XVector it seems (either its documentation or its implementation).

Your matrix looks like this:

 0.35  0.92  0.12
-0.70  0.35 -0.61
-0.61  0.12  0.78

So RightVector should be the first column (which it appears to correctly be) and XVector should be the first row (which it isn’t for some reason).

I think it’s a bug but can’t try it myself right now.

Basically nobody uses XVector so I wouldn’t be surprised if it just hasn’t come up

1 Like

It seems these are 2 problems

  • the description of RightVector in the docs is wrong (as noted by Narrator above)
  • the XVector method returns the same value as RightVector
1 Like

Yeah.

Since I wrote that linked post roblox updated their docs. Unfortunately it’s still wrong lol

RightVector

The right-direction component of the CFrame’s orientation. Equivalent to the first/left column of the rotation matrix, or Vector3.new(r00, r01, r02).

And:

XVector

Equivalent to the first row of the rotation matrix, or Vector3.new(r00, r01, r02).

CFrame.XVector and CFrame.RightVector return the same values. Same with YVector with UpVector and ZVector with -LookVector, they return the same values. I believe this is a bug.

I actually use XVector lol and other CFrame properties.

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