Why is the default rotation matrix misaligned from the basis vectors?

Given a default CFrame using CFrame.new(), the green arrow is the UpVector, the red arrow is the LookVector, and the blue arrow is the RightVector. Compare that to the basis vectors from the view selector. It would seem intuitive to me that these two rotations are aligned. Why are they not?

I can’t reproduce this; are you sure the axes on your part are pointing in the right directions?

I’m very sure. That image above was made using a custom module, so here’s a simpler repro:

workspace.Part.CFrame    = CFrame.new()
workspace.Up.Position    = CFrame.new().UpVector * 2
workspace.Right.Position = CFrame.new().RightVector * 2
workspace.Look.Position  = CFrame.new().LookVector * 2
1 Like

It’s most likely that the part is rotated

Oh I see what’s going on! For the default CFrame, the different vectors are defined like this:

LookVector = (0, 0, -1)
UpVector = (0, 1, 0)
RightVector = (1, 0, 0)

That lines up with your picture - the thing that’s throwing you off is most likely these two things:

  • The vector associated with the positive Z axis is the BackVector, not the LookVector
  • The colours of the RightVector part and the LookVector part should be swapped

Once you do that, it should line up just fine. Hope that helps :grinning:

Whhyyy that’s so counterintuitive. There’s gotta be a good reason for this but it eludes me.

1 Like