Overview
LCKTablet includes three built-in camera modes, each derived from ULCKBaseCameraMode. Camera modes control how the scene capture component is positioned and oriented relative to the player.
ULCKBaseCameraMode
Abstract base class for camera mode implementations.
UCLASS(Abstract)
class LCKTABLET_API ULCKBaseCameraMode : public UActorComponent
{
GENERATED_BODY()
public:
virtual void ActivateMode(UCameraComponent* Camera);
virtual void DeactivateMode(UCameraComponent* Camera);
virtual void SetSmoothness(float Smoothness);
virtual void SetDistance(float Distance);
virtual void SetCameraRoot(USceneComponent* Root);
virtual void SetSpringArm(USpringArmComponent* Arm);
};
Selfie Camera Mode
Front-facing camera with optional follow mode that tracks tablet orientation.
- Follow Mode: Camera follows tablet orientation smoothly
- Front/Rear Toggle: Switch between selfie and outward-facing
- Adjustable FOV: Customize field of view
- Smoothness Control: Adjust camera movement smoothing
| Setting | Type | Description |
|---|
SelfieFOV | float | Field of view (60-120) |
SelfieSmoothness | float | Movement smoothing (0-1) |
SelfieIsFollowing | bool | Enable follow mode |
SelfieFollowDistance | float | Distance in follow mode |
SelfieCameraFacing | ELCKCameraFacing | Front or Rear |
// Via data model
ULCKTabletDataModel* Model = Tablet->GetDataModel();
// Adjust FOV (direction: -1 decrease, +1 increase)
Model->SetSelfieFOV(1);
// Toggle follow mode
Model->ToggleSelfieIsFollowing();
// Toggle front/rear
Model->ToggleSelfieCameraFacing();
// Set smoothness
Model->SetSelfieSmoothness(1);
// Subscribe to changes
Model->OnSelfieFOVChanged.AddLambda([](float NewFOV) {
UE_LOG(LogTemp, Log, TEXT("Selfie FOV: %.1f"), NewFOV);
});
First Person Camera Mode
Point-of-view camera attached to the player’s view for immersive capture.
- Direct POV: Captures exactly what the player sees
- Adjustable FOV: Match or differ from player FOV
- Smooth Movement: Configurable smoothing for stability
| Setting | Type | Description |
|---|
FirstPersonFOV | float | Field of view (60-120) |
FirstPersonSmoothness | float | Movement smoothing (0-1) |
ULCKTabletDataModel* Model = Tablet->GetDataModel();
// Adjust FOV
Model->SetFirstPersonFOV(1); // +1 to increase
// Adjust smoothness
Model->SetFirstPersonSmoothness(-1); // -1 to decrease
// Subscribe to changes
Model->OnFirstPersonFOVChanged.AddLambda([](float NewFOV) {
UE_LOG(LogTemp, Log, TEXT("First Person FOV: %.1f"), NewFOV);
});
Third Person Camera Mode
Behind-player camera with adjustable distance for action shots.
- Adjustable Distance: Control camera distance from player
- Front/Back Toggle: Position camera in front or behind
- FOV Control: Customize field of view
- Smooth Follow: Configurable smoothing
| Setting | Type | Description |
|---|
ThirdPersonFOV | float | Field of view (60-120) |
ThirdPersonSmoothness | float | Movement smoothing (0-1) |
ThirdPersonDistance | float | Distance from player |
bThirdPersonIsFront | bool | Position in front of player |
ULCKTabletDataModel* Model = Tablet->GetDataModel();
// Adjust distance
Model->SetThirdPersonDistance(1); // +1 to increase
// Toggle front/back position
Model->ToggleThirdPersonIsFront();
// Subscribe to changes
Model->OnThirdPersonDistanceChanged.AddLambda([](float NewDistance) {
UE_LOG(LogTemp, Log, TEXT("Third Person Distance: %.1f"), NewDistance);
});
Switching Camera Modes
ULCKTabletDataModel* Model = Tablet->GetDataModel();
// Switch to a camera mode
Model->SetCameraMode(ULCKSelfieCameraMode::StaticClass());
Model->SetCameraMode(ULCKFirstPersonCameraMode::StaticClass());
Model->SetCameraMode(ULCKThirdPersonCameraMode::StaticClass());
// Subscribe to mode changes
Model->OnTabletCameraModeChanged.AddLambda([](UClass* NewModeClass) {
UE_LOG(LogTemp, Log, TEXT("Camera mode changed to: %s"), *NewModeClass->GetName());
});
Creating Custom Camera Modes
Create Subclass
Create a new class derived from ULCKBaseCameraMode:UCLASS()
class UMyCustomCameraMode : public ULCKBaseCameraMode
{
GENERATED_BODY()
public:
virtual void ActivateMode(UCameraComponent* Camera) override;
virtual void DeactivateMode(UCameraComponent* Camera) override;
};
Implement Activation
void UMyCustomCameraMode::ActivateMode(UCameraComponent* Camera)
{
Super::ActivateMode(Camera);
// Configure camera for this mode
Camera->SetFieldOfView(90.0f);
// Set up any custom behavior
}
void UMyCustomCameraMode::DeactivateMode(UCameraComponent* Camera)
{
// Clean up custom behavior
Super::DeactivateMode(Camera);
}
Register with Tablet
Add your custom camera mode component to the tablet actor and register it in the mode selection UI.
Camera Mode Delegates
| Delegate | Description |
|---|
OnTabletCameraModeChanged | Camera mode class changed |
OnSelfieFOVChanged | Selfie FOV value changed |
OnSelfieSmoothnessChanged | Selfie smoothness changed |
OnSelfieIsFollowingChanged | Follow mode toggled |
OnSelfieFollowDistanceChanged | Follow distance changed |
OnSelfieCameraFacingChanged | Front/rear changed |
OnFirstPersonFOVChanged | First person FOV changed |
OnFirstPersonSmoothnessChanged | First person smoothness changed |
OnThirdPersonFOVChanged | Third person FOV changed |
OnThirdPersonSmoothnessChanged | Third person smoothness changed |
OnThirdPersonDistanceChanged | Third person distance changed |
OnThirdPersonIsFrontPositionChanged | Front/back position changed |
All camera mode delegates broadcast the new value when changed, making it easy to sync UI elements with current settings.