Camera module throwing errors on every frame with Enum.CameraType.Watch (CameraModule.BaseCamera:1502)

Issue Type: Display
Impact: High
Frequency: Constantly
Date First Experienced: 2021-04-01 00:04:00 (+01:00)
Date Last Experienced: 2021-04-14 00:04:00 (+01:00)

Reproduction Steps:
I have created a simple repro file. In StarterPlayerScripts there is a local script that contains the following code:

wait(1)

local camBlock = workspace.CameraPart
workspace.CurrentCamera.CameraSubject = camBlock
workspace.CurrentCamera.CFrame =  camBlock.CFrame
workspace.CurrentCamera.CameraType = Enum.CameraType.Watch

The wait is vital for the repro to work. In my production game, there is no wait but instead the code is triggered by a remote event fired by the server. Removing the wait from this script (or even reducing it to just a wait()) doesn’t trigger the issue.

If you remove the wait, you will be able to spectate the block - but this is incorrect behaviour. Instead the camera should be fixed in place and unable to move. This is the behaviour that this code has exhibited since at least January 2020. It has only my come to my attention in the last few days that the code errors on every frame. I do not know exactly when it started to happen.

CameraRepro.rbxl (21.9 KB)

Expected Behavior:
This is the correct behaviour, but has errors in the output

This is incorrect behaviour (I can rotate the camera around the part) but there are no errors

Actual Behavior:
Output is spammed with output on every frame.
This appears also to be interfering with changing lighting on the client, as all the maps I am making the camera focus on are completely dark until the camera switches back to normal. (I assume because this error is preventing other local scripts from firing correctly)

Aside from the lighting not working properly in my production game, the code still functions correctly and the camera is fixed looking at an invisible part (my use case) whereby the player is unable to rotate the camera, as intended.

image

Workaround:

2 Likes

The clamp error is happening in other cases too, could be related to PlayerModule.CameraModule.TransparencyController:168: invalid argument #3 to 'clamp' - #7 by YummyLava57

1 Like

Thanks for the report! We’ve filed a ticket to our internal database and we’ll follow up when we have an update for you.

2 Likes

Hi there! It looks like you’re getting all these errors because the camera’s position is being set to the same position as the camerasubject and is set to watch. The error is occurring because we can’t calculate which direction the camera should be facing and therefore don’t update the camera at all (resulting in the fixed camera behavior). There should be a more meaningful error message coming soon, but in the meantime, I would recommend looking into CameraType.Fixed to produce the same behavior that you want since right now you are relying upon the error to keep the camera fixed.

4 Likes

Ah ok thanks! I tried modifying my script to use .Fixed but it wasn’t the same; instead of looking at an object far away, I was locked into looking at myself but from the side profile.

For anyone else with this issue, I played around with it and found that CameraType.Scriptable was the one which perfectly replicated the behaviour I had before.

1 Like

This issue should now be resolved! If this issue is still occurring, please create a new topic for us to look into.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.