Convert Origin Orientation to CFrame?

When working with Viewport Frames, I play around with the displayed Model in-game to figure out the Position and Orientation I need to use.

For example, I create the CFrame for the Model CFrame.new(Vector3.new(0, -.25, 0), Vector3.new(-90, -100, 0)) and then set the Model’s PrimaryCFrame to it viewItem:SetPrimaryPartCFrame(cFrame)

I’m able to just copy / paste the Vector3 Origin Position into the CFrame, and that works perfectly.
When I try the same with Origin Orientation, it gets changed when the game starts.

For example, CFrame.new(Vector3.new(0, -.25, 0), Vector3.new(-90, -100, 0) more specifically Vector3.new(-90, -100, 0) gets changed to -47.94, 90, 0 as the Origin Orientation.

Might anyone know either a better / easier way to work with the Orientation?

1 Like

CFrame.fromOrientation() is this the constructor you’re looking for?

That seems like it could be useful, but is there a way I could still specific the position?

If you’re trying to move a model then MoveTo() takes a Vector3 value (which represents the position in the worldspace) to move the model to.

Ah I see what you mean, thanks!
I did just try using fromOrientation CFrame.fromOrientation(30, -2.5, 5), but this turns into -81.13, -143.24, -73.52 in game.

The in-game value is the CFrame value in its entirety, CFrame.fromOrientation creates a CFrame value based off the provided Orientation value (which is a Vector3). Hence the difference in component values.