How can I indicate which face the camera should look at?

The first image shows a green object, called “part”:

Using the code below, I want the camera to focus on the thin face of the green object (right face), like here:

local camera = workspace.CurrentCamera
local part = workspace.Wedge
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = part
local offsetCFrame = CFrame.new(0, 0, 10)
camera.CFrame = part.CFrame:ToWorldSpace(offsetCFrame)

However, the camera is facing only to the FRONT face:

How can I indicate which face the camera should look at?

I changed the offsetCFrame to CFrame.new(10,0,0) and added a rotation to the new CFrame:

local offsetCFrame = CFrame.new(-10,0,0)
camera.CFrame = part.CFrame:ToWorldSpace(offsetCFrame) * CFrame.Angles(0, -math.pi/2, 0)

You might have to play with the offset, but this should work.

If you want to view the opposite side,

local offsetCFrame = CFrame.new(10,0,0)
camera.CFrame = part.CFrame:ToWorldSpace(offsetCFrame) * CFrame.Angles(0, math.pi/2, 0)

What you currently have moves the camera 10 studs behind the green part (relative to the green part’s orientation). The updated script options I’ve written move the camera 10 studs to the left (to the right in the second option) and then rotate 90 degrees toward the green part.

1 Like