I want to set the focus of the camera to be a fixed value (in my case 6"). Objects that are 6in from the camera will be in focus and anything else will be out of focus.
But I don't see any way to hook into the focus value of the iphone camera. You can turn the autofocus on and off or even focus to a point in your image, but that will not work in my case.
Any thoughts?
Can you force the focus of the camera to be a given distance?
No. You can't currently set the focus distance manually in iOS. There are no public APIs to do so.
Related
In MapBoxGL JS the pitch of a map can be changed by holding down the CTRL key, holding down the mouse and then moving it. Is there an equivalent way to accomplish this on a touch screen with no keyboard (e.g. smartphones). The context of this question - I want to use mapInstance.getPitch to record the last pitch selected by the user.
Yes, using two fingers on one's smartphone.
I added some ui elements to my game and they work properly in unity and on my device when connected to unity remote.
But I uploaded it to google play, downloaded it, and some text doesn't appear, buttons aren't pressable, and the background is red for some reason (supposed to be blue). Anyone know what's going on?
It may be a ratio problem, to fix this use anchors in your UI elements by using the anchor presets or by using the anchor or by using the anchor min and max values in insector, to make it scale with size you can set its UI Scale Mode to Scale With Screen Size.(https://docs.unity3d.com/Packages/com.unity.ugui#1.0/manual/HOWTO-UIMultiResolution.html). Let me know if that helps
Currently I'm using this library:
https://pub.dev/packages/camera and it has setFocusMode to either Auto or locked, but I need a way to be able to get manual focus mode for camera, where user can tap in camera feed and the focus should be adjusted accordingly.
How do I go about implementing this in my app?
I found this plugin https://pub.dev/documentation/manual_camera/latest/. Does this work? you could use focus distance. If you could get the distance of the object you could set it that way. It's almost like shooting out a ray in game programming. I don't know if this is possible to do but maybe using the size of the objects in the image you could get the distance. someone else has probably already figured this out.
I'm quite new to Unity, so I'm sorry if this is a basic question. I've been trying to set up the UI for a mobile game, but I'm not quite sure how to make the UI lock it's position, no matter the screen size. I've tried using anchors (though I don't fully understand how to use them properly), I've tried using a canvas scaler, I've looked at the Unity document and I just can't seem to find an answer. The buttons are off screen/half off the screen when I build the game to my device/switch screen sizes in the game view. Does anyone know how to fix this?
You can set your anchor point by selecting the UI object (such as a button) and then clicking here and selecting the right anchor point. You can also press down shift to set the pivot and/or alt to move the object to that point at the same time. The object should now be anchored to that point and keep its position even if the resolution is changed. You can set a precise position from the inspector, too. Simply adjust the Pos X and Pos Y variables. It will still adhere to the anchor point.
Note that you might have to play around with the Canvas object's UI Scale mode and its settings to get the right setup.
I've been looking for a camera property that tells the distance between the camera and the object in focus, but without success.
Considering the phone has autofocus, one should be able to tell the distance simply by checking the focal length. Also the taken images taken has the following properties, which both should be what I'm looking for:
kCGImagePropertyExifFocalLength
kCGImagePropertyExifSubjectDistance
Is there a way to see these properties already in the camera without taking the picture?