Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is the CameraSubject not attaching to the brick?

Asked by
dirk2999 103
5 years ago

Everything works but when the BlackOut Frame goes away, the camera is just stuck wherever it was before, not the brick.

local cam = workspace.CurrentCamera
local cartCameraBlock = workspace.Configuration.cartSelectorCam

wait(5)
for i = 1,0,-.05 do
    script.Parent.blackoutFrame.BackgroundTransparency = i
    wait()
end
repeat
    wait()
    cam.CameraType = Enum.CameraType.Scriptable
until cam.CameraType == Enum.CameraType.Scriptable
cam.CameraSubject = cartCameraBlock
for i = 0,1,.05 do
    script.Parent.blackoutFrame.BackgroundTransparency = i
    wait()
end

1 answer

Log in to vote
1
Answered by
amanda 1059 Moderation Voter
5 years ago

Whenever you set the CameraType to Scriptable, and then change the CameraSubject to anything but a player's Character, the camera will only be moved manually by changing it's CFrame, or by changing it's type again and setting the CameraSubject.

So with that said, a Scriptable camera will NOT focus on the new CameraSubject automatically. If you want this effect while in this mode, you must do the math and manually CFrame it to be so.

Otherwise, I recommend Enum.CameraType.Watch, which does automatically focus on the set CameraSubject.

cam.CameraType = Enum.CameraType.Watch
cam.CameraSubject = cartCameraBlock

As a side note, there is no need for the following snippet to be in your code:

repeat
    wait()
    cam.CameraType = Enum.CameraType.Scriptable
until cam.CameraType == Enum.CameraType.Scriptable

I am assuming you have that just because you didn't know how the Scriptable type worked, and wanted to make sure it was set, however it is ultimately not useful to you.

0
That worked! Thank you, one more question if you don't mind answering, how do I angle the camera? I tried multiplying it by CFrame.Angles and got an error. dirk2999 103 — 5y
Ad

Answer this question