Hi,
I am trying to attach a scenecapture component to a camera, so I can capture and save images camera is seeing. I am trying to configure this component in C++ code (most examples on the web are from Blueprints). Can anybody point me to any working code or give me some guidance? Would much appreciate.
Below is my code, using a viewer pawn with an attached camera
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include “GameFramework/Pawn.h”
#include “ViewPawn.generated.h”
UCLASS()
class CAPTURE3_API AViewPawn : public APawn
{
GENERATED_BODY()
public:
// Sets default values for this pawn’s properties
AViewPawn();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
protected:
UPROPERTY(EditAnywhere)
USpringArmComponent* OurCameraSpringArm;
UCameraComponent* OurCamera;
// UTextRenderComponent* ShowText;
USceneCaptureComponent2D* SceneCapture;
// Input variables
FVector2D MovementInput;
FVector2D CameraInput;
float ZoomFactor;
bool bZoomingIn;
bool bEnableCapture;
// Input functions
void MoveForward(float AxisValue);
void MoveRight(float AxisValue);
void PitchCamera(float AxisValue);
void YawCamera(float AxisValue);
void ZoomIn();
void ZoomOut();
void DoCapture();
};