How to access the CameraModule script from another script?

Hi, I’m attempting to force players to be in shiftlock through the CameraModule. I do not want to directly modify the CameraModule because I will have to use that version of the module, forgoing any potential updates to it. Instead I’d like to access it through another local script.

Unfortunately, it seems that the CameraModule is closed off, in that it does not return the instantiated form of the CameraModule class, but it returns an empty table.

image

As you can see, the empty table is returned because FFlagUserRemoveTheCameraApi is true. Like I said, I’m hesitant to modify the code because I will have to actually use this stagnant form of the CameraModule in place of what could eventually be an updated CameraModule.

Is there any workaround to access the code in the CameraModule where I don’t have to modify the CameraModule script? Thanks.

I’m pretty sure there is no way to get around this at the moment.

However, there is a feature request here to remove this so maybe this functionality will change in the future??

As for now, I would say that your only option is to directly modify the camera scripts or make your own custom shift lock. I answered this thread related to implementing a custom shift lock the other day.

1 Like

Hey @subcritical, is there a new Camera API in the works now to cover these use cases?

3 Likes