godotengine / godot-ios-plugins

MIT License
126 stars 48 forks source link

iOS camera focus control (or auto-focus) #27

Open vanoak opened 2 years ago

vanoak commented 2 years ago

Hello,

First of all this is not an issue, the plugin works as expected. I have a doubt though. Is it possible to change the camera focus ? Or enable auto-focus? Thank you.

vanoak commented 2 years ago

Noticed this [p_device setFocusMode:AVCaptureFocusModeLocked]; in plugins/camera/camera_ios.mm (line 75). Could it be the case of changing to continuousAutoFocus?

SOURCE: https://stackoverflow.com/questions/49541837/swift-autofocus-expose-and-continuousautofocus-exposure-at-the-same-time

naithar commented 2 years ago

It's possible to use AVCaptureFocusModeContinuousAutoFocus instead of AVCaptureFocusModeLocked, but it would change the way plugin works for everyone, since Godot's CameraFeed doesn't support any way to setup focus modes.

vanoak commented 2 years ago

Alright, I think that can work for the project I'm working at the moment. I will try it tomorrow.

vanoak commented 2 years ago

Hi again,

It works (just the continuous autofocus). I recompiled the xcframework (debug and the release) and duplicated the previous configuration.

Thank you @naithar.

naithar commented 2 years ago

@vanoak that's great news :) I think plugin should provide the way to setup some parameters like focus, but I can't think of any way to add this configuration except for extending Godot's CameraFeed