Selfie Cam
The Selfie Cam example is made up of several modular pieces to showcase the various features required for the end-to-end flow.
At a high-level, the system is composed of the following key components and functions:
BPC_SelfieCamComponent
A component attached to the BP_ODK_PlayerCharacterBase, responsible for toggling selfie camera mode. It spawns the BP_SelfieCameraActor.
BP_SelfieCameraActor
This actor contains a CineCamera component. Once spawned, it attaches to the player's hand socket and communicates its location to the Animation Blueprint via a Blueprint Interface. This enables the Animation Blueprint to sync the hand's location using an IK chain. The actor also manages the Camera UI and binds to its events.
BPC_HighResShot
Another component on BP_ODK_PlayerCharacterBase, with a Take Screenshot event that allows specifying location, format, and resolution. It can display an optional preview widget, which is customizable and works with a Blueprint Interface for swapping. The component also includes the following Event Dispatchers: OnHighResShotSaved, OnFlashShown, OnFlashClosed, and OnPreviewShown.
BPFL_ScreenshotTools
After a screenshot is saved, the image can be uploaded to the user collection using the User Collection Upload Screenshot function from the BPFL_ScreenshotTools library.
The Selfie Cam can be activated using the IMC_SelfieMode Enhanced Input Mapping with the following actions:
IA_ScreenshotCamera_Toggle - Enable/Disable the Selfie Camera
IA_RotateCamera - Rotate the camera when active
IA_ZoomCamera - Changes to field of view to simulate camera zoom
IA_SelfieMode_TakeSnapshot - Save the image to disk
The selfie cam is capable of saving high resolution images to disk and uploading them. This could lead to several large files being uploaded by multiple users. To mitigate any risk, several Live Config values have been added:
ODK.SelfieCam.Enabled - Allows for disabling the activation of the Selfie Cam. If this is set to false, when a user presses the toggle shortcut, the BP_SelfieCamActor will not be spawned. ODK.Collections.AllowImageUpload - Users will stil be able to use the Selfie Cam, but the Image Upload option will be disabled.