Hello, currently I am trying to create a camera for use in a ViewportFrame I can correctly set the CFrame Positions but not the Orientations.
The camera type is set to scriptable.
local pos = Vector3.new(-5.118, 1005.512, -167.479)
camera.CFrame = CFrame.new(pos)
camera.CFrame = camera.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(-16.485), math.rad(-142.803), 0)
I have researched for many solutions and understand the roatation is applied in ZYX order.
![image0-10](//devforum-uploads.s3.dualstack.us-east-2.amazonaws.com/uploads/original/5X/5/5/5/4/555490c4e60460a994825ee321cce6d4ed520b58.png)
The above is the orientation this code produces.
If you want the same angles in the orientation then you should use
CFrame:fromEulerAnglesYXZ() or the equivalent CFrame:fromOrientation()
local pos = Vector3.new(-5.118, 1005.512, -167.479)
camera.CFrame = CFrame.new(pos)
camera.CFrame = camera.CFrame * CFrame.fromEulerAnglesYXZ(math.rad(-16.485), math.rad(-142.803), 0)
Should produce the result that I believe you’re looking for.
Thank you that has fixed the issue.
system
(system)
Closed
#4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.