Skip to content

Instantly share code, notes, and snippets.

@alfredbaudisch
Last active April 23, 2024 15:46
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alfredbaudisch/7978f1913e76640e2dc25b770ffa6ae1 to your computer and use it in GitHub Desktop.
Save alfredbaudisch/7978f1913e76640e2dc25b770ffa6ae1 to your computer and use it in GitHub Desktop.
Unreal Engine OcclusionAwarePlayerController to make actors/meshes transparent when they block the Camera. This is a simple see-through solution that does not require any changes to your scene or actors. To learn more details and instructions on how to use, check my post: https://alfredbaudisch.com/blog/gamedev/unreal-engine-ue/unreal-engine-act…
/**
* !! NOTICE !!
* Instructions: https://alfredbaudisch.com/blog/gamedev/unreal-engine-ue/unreal-engine-actors-transparent-block-camera-occlusion-see-through/
*/
// OcclusionAwarePlayerController.h
// By Alfred Reinold Baudisch (https://github.com/alfredbaudisch)
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "Camera/CameraComponent.h"
#include "Components/CapsuleComponent.h"
#include "GameFramework/SpringArmComponent.h"
#include "OcclusionAwarePlayerController.generated.h"
USTRUCT(BlueprintType)
struct FCameraOccludedActor
{
GENERATED_USTRUCT_BODY()
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
const AActor* Actor;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
UStaticMeshComponent* StaticMesh;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
TArray<UMaterialInterface*> Materials;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
bool IsOccluded;
};
/**
*
*/
UCLASS()
class YOURGAME_API AOcclusionAwarePlayerController : public APlayerController
{
GENERATED_BODY()
public:
AOcclusionAwarePlayerController();
protected:
// Called when the game starts
virtual void BeginPlay() override;
/** How much of the Pawn capsule Radius and Height
* should be used for the Line Trace before considering an Actor occluded?
* Values too low may make the camera clip through walls.
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Camera Occlusion|Occlusion",
meta=(ClampMin="0.1", ClampMax="10.0") )
float CapsulePercentageForTrace;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Camera Occlusion|Materials")
UMaterialInterface* FadeMaterial;
UPROPERTY(BlueprintReadWrite, Category="Camera Occlusion|Components")
class USpringArmComponent* ActiveSpringArm;
UPROPERTY(BlueprintReadWrite, Category="Camera Occlusion|Components")
class UCameraComponent* ActiveCamera;
UPROPERTY(BlueprintReadWrite, Category="Camera Occlusion|Components")
class UCapsuleComponent* ActiveCapsuleComponent;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Camera Occlusion")
bool IsOcclusionEnabled;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Camera Occlusion|Occlusion")
bool DebugLineTraces;
private:
TMap<const AActor*, FCameraOccludedActor> OccludedActors;
bool HideOccludedActor(const AActor* Actor);
bool OnHideOccludedActor(const FCameraOccludedActor& OccludedActor) const;
void ShowOccludedActor(FCameraOccludedActor& OccludedActor);
bool OnShowOccludedActor(const FCameraOccludedActor& OccludedActor) const;
void ForceShowOccludedActors();
__forceinline bool ShouldCheckCameraOcclusion() const
{
return IsOcclusionEnabled && FadeMaterial && ActiveCamera && ActiveCapsuleComponent;
}
public:
UFUNCTION(BlueprintCallable)
void SyncOccludedActors();
};
/**
* !! NOTICE !!
* Instructions: https://alfredbaudisch.com/blog/gamedev/unreal-engine-ue/unreal-engine-actors-transparent-block-camera-occlusion-see-through/
*/
// OcclusionAwarePlayerController.cpp
// By Alfred Reinold Baudisch (https://github.com/alfredbaudisch)
#include "OcclusionAwarePlayerController.h"
#include "Kismet/GameplayStatics.h"
#include "Kismet/KismetSystemLibrary.h"
#include "Containers/Set.h"
AOcclusionAwarePlayerController::AOcclusionAwarePlayerController()
{
CapsulePercentageForTrace = 1.0f;
DebugLineTraces = true;
IsOcclusionEnabled = true;
}
void AOcclusionAwarePlayerController::BeginPlay()
{
Super::BeginPlay();
if (IsValid(GetPawn()))
{
ActiveSpringArm = Cast<
USpringArmComponent>(GetPawn()->GetComponentByClass(USpringArmComponent::StaticClass()));
ActiveCamera = Cast<UCameraComponent>(GetPawn()->GetComponentByClass(UCameraComponent::StaticClass()));
ActiveCapsuleComponent = Cast<UCapsuleComponent>(
GetPawn()->GetComponentByClass(UCapsuleComponent::StaticClass()));
}
}
void AOcclusionAwarePlayerController::SyncOccludedActors()
{
if (!ShouldCheckCameraOcclusion()) return;
// Camera is currently colliding, show all current occluded actors
// and do not perform further occlusion
if (ActiveSpringArm->bDoCollisionTest)
{
ForceShowOccludedActors();
return;
}
FVector Start = ActiveCamera->GetComponentLocation();
FVector End = GetPawn()->GetActorLocation();
TArray<TEnumAsByte<EObjectTypeQuery>> CollisionObjectTypes;
CollisionObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECC_WorldStatic));
TArray<AActor*> ActorsToIgnore; // TODO: Add configuration to ignore actor types
TArray<FHitResult> OutHits;
auto ShouldDebug = DebugLineTraces ? EDrawDebugTrace::ForDuration : EDrawDebugTrace::None;
bool bGotHits = UKismetSystemLibrary::CapsuleTraceMultiForObjects(
GetWorld(), Start, End, ActiveCapsuleComponent->GetScaledCapsuleRadius() * CapsulePercentageForTrace,
ActiveCapsuleComponent->GetScaledCapsuleHalfHeight() * CapsulePercentageForTrace, CollisionObjectTypes, true,
ActorsToIgnore,
ShouldDebug,
OutHits, true);
if (bGotHits)
{
// The list of actors hit by the line trace, that means that they are occluded from view
TSet<const AActor*> ActorsJustOccluded;
// Hide actors that are occluded by the camera
for (FHitResult Hit : OutHits)
{
const AActor* HitActor = Cast<AActor>(Hit.GetActor());
HideOccludedActor(HitActor);
ActorsJustOccluded.Add(HitActor);
}
// Show actors that are currently hidden but that are not occluded by the camera anymore
for (auto& Elem : OccludedActors)
{
if (!ActorsJustOccluded.Contains(Elem.Value.Actor) && Elem.Value.IsOccluded)
{
ShowOccludedActor(Elem.Value);
if (DebugLineTraces)
{
UE_LOG(LogTemp, Warning,
TEXT("Actor %s was occluded, but it's not occluded anymore with the new hits."), *Elem.Value.Actor->GetName());
}
}
}
}
else
{
ForceShowOccludedActors();
}
}
bool AOcclusionAwarePlayerController::HideOccludedActor(const AActor* Actor)
{
FCameraOccludedActor* ExistingOccludedActor = OccludedActors.Find(Actor);
if (ExistingOccludedActor && ExistingOccludedActor->IsOccluded)
{
if (DebugLineTraces) UE_LOG(LogTemp, Warning, TEXT("Actor %s was already occluded. Ignoring."),
*Actor->GetName());
return false;
}
if (ExistingOccludedActor && IsValid(ExistingOccludedActor->Actor))
{
ExistingOccludedActor->IsOccluded = true;
OnHideOccludedActor(*ExistingOccludedActor);
if (DebugLineTraces) UE_LOG(LogTemp, Warning, TEXT("Actor %s exists, but was not occluded. Occluding it now."), *Actor->GetName());
}
else
{
UStaticMeshComponent* StaticMesh = Cast<UStaticMeshComponent>(
Actor->GetComponentByClass(UStaticMeshComponent::StaticClass()));
FCameraOccludedActor OccludedActor;
OccludedActor.Actor = Actor;
OccludedActor.StaticMesh = StaticMesh;
OccludedActor.Materials = StaticMesh->GetMaterials();
OccludedActor.IsOccluded = true;
OccludedActors.Add(Actor, OccludedActor);
OnHideOccludedActor(OccludedActor);
if (DebugLineTraces) UE_LOG(LogTemp, Warning, TEXT("Actor %s does not exist, creating and occluding it now."), *Actor->GetName());
}
return true;
}
void AOcclusionAwarePlayerController::ForceShowOccludedActors()
{
for (auto& Elem : OccludedActors)
{
if (Elem.Value.IsOccluded)
{
ShowOccludedActor(Elem.Value);
if (DebugLineTraces) UE_LOG(LogTemp, Warning, TEXT("Actor %s was occluded, force to show again."), *Elem.Value.Actor->GetName());
}
}
}
void AOcclusionAwarePlayerController::ShowOccludedActor(FCameraOccludedActor& OccludedActor)
{
if (!IsValid(OccludedActor.Actor))
{
OccludedActors.Remove(OccludedActor.Actor);
}
OccludedActor.IsOccluded = false;
OnShowOccludedActor(OccludedActor);
}
bool AOcclusionAwarePlayerController::OnShowOccludedActor(const FCameraOccludedActor& OccludedActor) const
{
for (int matIdx = 0; matIdx < OccludedActor.Materials.Num(); ++matIdx)
{
OccludedActor.StaticMesh->SetMaterial(matIdx, OccludedActor.Materials[matIdx]);
}
return true;
}
bool AOcclusionAwarePlayerController::OnHideOccludedActor(const FCameraOccludedActor& OccludedActor) const
{
for (int i = 0; i < OccludedActor.StaticMesh->GetNumMaterials(); ++i)
{
OccludedActor.StaticMesh->SetMaterial(i, FadeMaterial);
}
return true;
}
@StoreBoughtRocketGames
Copy link

It looks like this doesn't work with Unreal engine 5.1. I'm getting an error 'Actor' is not a member of 'FHitResult' on line 68 of the .cpp file. If it doesn't work for UE5, could you add a note to the blog post? Really disappointed I couldn't use it. Looked like a really simple solution too. But, I'm not versed in c++ with UE at all.

2>[2/6] Compile OcclusionAwarePlayerController.cpp
2>C:\Repositories\BadArtJam\ProjectCode\BadArtJam\Source\BadArtJam\OcclusionAwarePlayerController.cpp(68): error C2039: 'Actor': is not a member of 'FHitResult'
2>C:\Program Files\Epic Games\UE_5.1\Engine\Intermediate\Build\Win64\UnrealEditor\Inc\Engine\UHT\GameplayStatics.generated.h(55): note: see declaration of 'FHitResult'
2>[3/6] Compile OcclusionAwarePlayerController.gen.cpp
2>[4/6] Link UnrealEditor-BadArtJam.lib cancelled
2>[5/6] Link UnrealEditor-BadArtJam.dll cancelled
2>[6/6] WriteMetadata BadArtJamEditor.target cancelled

@wxvyjb
Copy link

wxvyjb commented Dec 28, 2023

It looks like this doesn't work with Unreal engine 5.1. I'm getting an error 'Actor' is not a member of 'FHitResult' on line 68 of the .cpp file. If it doesn't work for UE5, could you add a note to the blog post? Really disappointed I couldn't use it. Looked like a really simple solution too. But, I'm not versed in c++ with UE at all.

2>[2/6] Compile OcclusionAwarePlayerController.cpp 2>C:\Repositories\BadArtJam\ProjectCode\BadArtJam\Source\BadArtJam\OcclusionAwarePlayerController.cpp(68): error C2039: 'Actor': is not a member of 'FHitResult' 2>C:\Program Files\Epic Games\UE_5.1\Engine\Intermediate\Build\Win64\UnrealEditor\Inc\Engine\UHT\GameplayStatics.generated.h(55): note: see declaration of 'FHitResult' 2>[3/6] Compile OcclusionAwarePlayerController.gen.cpp 2>[4/6] Link UnrealEditor-BadArtJam.lib cancelled 2>[5/6] Link UnrealEditor-BadArtJam.dll cancelled 2>[6/6] WriteMetadata BadArtJamEditor.target cancelled

https://docs.unrealengine.com/5.3/en-US/API/Runtime/Engine/Engine/FHitResult/GetActor/

@SneakyFresh
Copy link

It looks like this doesn't work with Unreal engine 5.1. I'm getting an error 'Actor' is not a member of 'FHitResult' on line 68 of the .cpp file. If it doesn't work for UE5, could you add a note to the blog post? Really disappointed I couldn't use it. Looked like a really simple solution too. But, I'm not versed in c++ with UE at all.
2>[2/6] Compile OcclusionAwarePlayerController.cpp 2>C:\Repositories\BadArtJam\ProjectCode\BadArtJam\Source\BadArtJam\OcclusionAwarePlayerController.cpp(68): error C2039: 'Actor': is not a member of 'FHitResult' 2>C:\Program Files\Epic Games\UE_5.1\Engine\Intermediate\Build\Win64\UnrealEditor\Inc\Engine\UHT\GameplayStatics.generated.h(55): note: see declaration of 'FHitResult' 2>[3/6] Compile OcclusionAwarePlayerController.gen.cpp 2>[4/6] Link UnrealEditor-BadArtJam.lib cancelled 2>[5/6] Link UnrealEditor-BadArtJam.dll cancelled 2>[6/6] WriteMetadata BadArtJamEditor.target cancelled

https://docs.unrealengine.com/5.3/en-US/API/Runtime/Engine/Engine/FHitResult/GetActor/

What was your Solution? Read the docs and still cant seem to remedy it

@SneakyFresh
Copy link

Nevermind...

const AActor* HitActor = Cast(Hit.GetActor());

@alfredbaudisch
Copy link
Author

I'm currently using it with UE 5.3, works fine. I'm going to update the gist.

// Hide actors that are occluded by the camera
for (FHitResult Hit : OutHits)
{
	const AActor* HitActor = Cast<AActor>(Hit.GetActor());
	HideOccludedActor(HitActor);
	ActorsJustOccluded.Add(HitActor);
}

@SneakyFresh
Copy link

SneakyFresh commented Feb 1, 2024

Can swap out

OcclusionAwarePlayerController.cpp
Line 161 to 179

bool AOcclusionAwarePlayerController::OnShowOccludedActor(const FCameraOccludedActor& OccludedActor) const
{
  for (int matIdx = 0; matIdx < OccludedActor.Materials.Num(); ++matIdx)
  {
    OccludedActor.StaticMesh->SetMaterial(matIdx, OccludedActor.Materials[matIdx]);
  }

  return true;
}

bool AOcclusionAwarePlayerController::OnHideOccludedActor(const FCameraOccludedActor& OccludedActor) const
{
  for (int i = 0; i < OccludedActor.StaticMesh->GetNumMaterials(); ++i)
  {
    OccludedActor.StaticMesh->SetMaterial(i, FadeMaterial);
  }

  return true;
}

With

bool AOcclusionAwarePlayerController::OnShowOccludedActor(const FCameraOccludedActor& OccludedActor) const
{
    for (int matIdx = 0; matIdx < OccludedActor.Materials.Num(); ++matIdx)
    {
        OccludedActor.StaticMesh->SetMaterial(matIdx, OccludedActor.Materials[matIdx]);
    }
    // Changes Collision profile so the mouse colides with walls again.
    OccludedActor.StaticMesh->SetCollisionProfileName(FName("BlockAll"));
    return true;
    }

bool AOcclusionAwarePlayerController::OnHideOccludedActor(const FCameraOccludedActor & OccludedActor) const
{
    for (int i = 0; i < OccludedActor.StaticMesh->GetNumMaterials(); ++i)
    {
        OccludedActor.StaticMesh->SetMaterial(i, FadeMaterial);
    }
    // Changes Collision profile so the mouse doesnt colide with the invisible walls.
        OccludedActor.StaticMesh->SetCollisionProfileName(FName("InvisibleWall"));

    return true;
}

For a simple way of removing the mouse collision with invisible walls.

@SneakyFresh
Copy link

Also working on an array to work with it for object grouping. Will post here cause the source isnt my code :P

@SneakyFresh
Copy link

SneakyFresh commented Feb 4, 2024

Have it working for the most part. Though it may need a bit of fine tuning.

Remove whatever you have in OcclusionAwarePlayerController.cpp on Line 161 and below

{
    // Handle the occluded actor
    for (int matIdx = 0; matIdx < OccludedActor.Materials.Num(); ++matIdx)
    {
        OccludedActor.StaticMesh->SetMaterial(matIdx, OccludedActor.Materials[matIdx]);
    }
    OccludedActor.StaticMesh->SetCollisionProfileName(FName("BlockAll"));

    // Handle the attached actors
    TArray<AActor*> AttachedActors;
    OccludedActor.Actor->GetAttachedActors(AttachedActors);
    for (AActor* AttachedActor : AttachedActors)
    {
        UStaticMeshComponent* StaticMesh = Cast<UStaticMeshComponent>(AttachedActor->GetComponentByClass(UStaticMeshComponent::StaticClass()));
        if (StaticMesh)
        {
            for (int i = 0; i < StaticMesh->GetNumMaterials(); ++i)
            {
                StaticMesh->SetMaterial(i, OccludedActor.Materials[i]);
            }
            StaticMesh->SetCollisionProfileName(FName("BlockAll"));
        }
    }

    return true;
}

bool AOcclusionAwarePlayerController::OnHideOccludedActor(const FCameraOccludedActor& OccludedActor) const
{
    // Handle the occluded actor
    for (int i = 0; i < OccludedActor.StaticMesh->GetNumMaterials(); ++i)
    {
        OccludedActor.StaticMesh->SetMaterial(i, FadeMaterial);
    }
    OccludedActor.StaticMesh->SetCollisionProfileName(FName("InvisibleWall"));

    // Handle the attached actors
    TArray<AActor*> AttachedActors;
    OccludedActor.Actor->GetAttachedActors(AttachedActors);
    for (AActor* AttachedActor : AttachedActors)
    {
        UStaticMeshComponent* StaticMesh = Cast<UStaticMeshComponent>(AttachedActor->GetComponentByClass(UStaticMeshComponent::StaticClass()));
        if (StaticMesh)
        {
            for (int i = 0; i < StaticMesh->GetNumMaterials(); ++i)
            {
                StaticMesh->SetMaterial(i, FadeMaterial);
            }
            StaticMesh->SetCollisionProfileName(FName("InvisibleWall"));
        }
    }

    return true;
}

What this does is includes any attached actors to the parent that is being occluded.
For my own testing use, I had the floor as a parent, and attached the walls of that fall to it.

Viewport (Outliner)

└── Floor
    ├── Wall 1
    ├── Wall 2
    ├── Wall 3

So when under Floor, Wall 1 Wall 2 and Wall 3 are also hidden, but when above it the walls are handled as individuals and occluded by the default occlusion.

Let me know if anyone encounters issues

Be making it so it works when it is directly above the character pawn as well. Currently if the pawn is directly next to a wall on the below floor that the above floor still shows as there is no active camera occlusion.

@SneakyFresh
Copy link

SneakyFresh commented Feb 4, 2024

Ok, player Z was easy

Find - in OcclusionAwarePlayerController.cpp

    FVector Start = ActiveCamera->GetComponentLocation();
    FVector End = GetPawn()->GetActorLocation();

add below it

   End.Z += 100;  // HeightAbovePlayer is the distance above the player you want to include, dont make it too high as will cause issues later in your project with actors vanishing that are not suppose to vanish.

Enjoy

Edit: The End.Z doesnt work with layers. Will figure out how to loop the hitscan

@pekingduck4
Copy link

none of this is working in the tutorial
error
any tips for this???

@pekingduck4
Copy link

heres all the errors

[2/3] Compile [x64] OcclusionAwarePlayerController.gen.cpp
  E:\unrealprojects\cameratest\Source\cameratest\Public\OcclusionAwarePlayerController.h(35): error C2079: 'AOcclusionAwarePlayerController' uses undefined class 'DACHSHUNDSPA_API'
  E:\unrealprojects\cameratest\Source\cameratest\Public\OcclusionAwarePlayerController.h(35): error C2143: syntax error: missing ';' before ':'
  E:\unrealprojects\cameratest\Source\cameratest\Public\OcclusionAwarePlayerController.h(35): error C2059: syntax error: ':'
  E:\unrealprojects\cameratest\Source\cameratest\Public\OcclusionAwarePlayerController.h(35): error C2059: syntax error: 'public'
  E:\unrealprojects\cameratest\Source\cameratest\Public\OcclusionAwarePlayerController.h(36): error C2143: syntax error: missing ';' before '{'
  E:\unrealprojects\cameratest\Source\cameratest\Public\OcclusionAwarePlayerController.h(36): error C2447: '{': missing function header (old-style formal list?)
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(137): error C2027: use of undefined type 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.generated.h(105): note: see declaration of 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(141): error C2065: 'ThisClass': undeclared identifier
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(141): error C2059: syntax error: ')'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(144): error C2027: use of undefined type 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.generated.h(105): note: see declaration of 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(146): error C2027: use of undefined type 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.generated.h(105): note: see declaration of 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(146): error C2672: 'StaticClass': no matching overloaded function found
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(146): error C2783: 'UClass *StaticClass(void)': could not deduce template argument for 'ClassType'
  E:\Program Files\Epic Games\UE_5.2\Engine\Source\Runtime\CoreUObject\Public\UObject\ReflectedTypeAccessors.h(13): note: see declaration of 'StaticClass'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(148): error C2027: use of undefined type 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.generated.h(105): note: see declaration of 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(174): error C2027: use of undefined type 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.generated.h(105): note: see declaration of 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(174): error C3861: 'StaticPackage': identifier not found
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(174): error C2065: 'StaticClassFlags': undeclared identifier
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(174): error C2061: syntax error: identifier 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(177): error C2027: use of undefined type 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.generated.h(105): note: see declaration of 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(177): error C2672: 'StaticClass': no matching overloaded function found
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(177): error C2783: 'UClass *StaticClass(void)': could not deduce template argument for 'ClassType'
  E:\Program Files\Epic Games\UE_5.2\Engine\Source\Runtime\CoreUObject\Public\UObject\ReflectedTypeAccessors.h(13): note: see declaration of 'StaticClass'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(245): error C2615: 'offsetof' cannot be applied to non-class type 'int'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(252): error C2615: 'offsetof' cannot be applied to non-class type 'int'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(260): error C2615: 'offsetof' cannot be applied to non-class type 'int'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(268): error C2615: 'offsetof' cannot be applied to non-class type 'int'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(276): error C2615: 'offsetof' cannot be applied to non-class type 'int'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(285): error C2059: syntax error: ')'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(296): error C2059: syntax error: ')'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(309): error C2923: 'TCppClassTypeTraits': 'AOcclusionAwarePlayerController' is not a valid template type argument for parameter 'CPPCLASS'
  E:\unrealprojects\cameratest\Source\cameratest\Public\OcclusionAwarePlayerController.h(35): note: see declaration of 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(309): error C2955: 'TCppClassTypeTraits': use of class template requires template argument list
  E:\Program Files\Epic Games\UE_5.2\Engine\Source\Runtime\CoreUObject\Public\UObject\Class.h(2463): note: see declaration of 'TCppClassTypeTraits'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(309): error C4800: Implicit conversion from 'TCppClassTypeTraits<CPPCLASS>::<unnamed-enum-IsAbstract>' to bool. Possible information loss
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(310): note: consider using explicit cast or comparison to 0 to avoid this warning
  E:\Program Files\Epic Games\UE_5.2\Engine\Source\Runtime\CoreUObject\Public\UObject\Class.h(2466): note: see declaration of 'TCppClassTypeTraits<CPPCLASS>::<unnamed-enum-IsAbstract>'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(310): warning C4305: 'initializing': truncation from 'TCppClassTypeTraits<CPPCLASS>::<unnamed-enum-IsAbstract>' to 'bool'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(312): error C2027: use of undefined type 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.generated.h(105): note: see declaration of 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(312): error C2440: 'initializing': cannot convert from 'overloaded-function' to 'UClass *(__cdecl *)(void)'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(312): note: None of the functions with this name in scope match the target type
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(335): error C2912: explicit specialization 'UClass *StaticClass<AOcclusionAwarePlayerController>(void)' is not a specialization of a function template
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(336): error C2027: use of undefined type 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.generated.h(105): note: see declaration of 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(336): error C2672: 'StaticClass': no matching overloaded function found
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(336): error C2783: 'UClass *StaticClass(void)': could not deduce template argument for 'ClassType'
  E:\Program Files\Epic Games\UE_5.2\Engine\Source\Runtime\CoreUObject\Public\UObject\ReflectedTypeAccessors.h(13): note: see declaration of 'StaticClass'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(338): error C2027: use of undefined type 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.generated.h(105): note: see declaration of 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(338): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(338): error C2550: '{ctor}': constructor initializer lists are only allowed on constructor definitions
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(338): error C4508: '{ctor}': function should return a value; 'void' return type assumed
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(339): error C2027: use of undefined type 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.generated.h(105): note: see declaration of 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(339): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(339): error C4508: '{dtor}': function should return a value; 'void' return type assumed
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(349): error C2027: use of undefined type 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.generated.h(105): note: see declaration of 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(349): error C2440: 'initializing': cannot convert from 'UClass *(__cdecl *)(void)' to 'UClass *(__cdecl *)(void)'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.gen.cpp(349): note: None of the functions with this name in scope match the target type
  [3/3] Compile [x64] OcclusionAwarePlayerController.cpp
  E:\unrealprojects\cameratest\Source\cameratest\Public\OcclusionAwarePlayerController.h(35): error C2079: 'AOcclusionAwarePlayerController' uses undefined class 'DACHSHUNDSPA_API'
  E:\unrealprojects\cameratest\Source\cameratest\Public\OcclusionAwarePlayerController.h(35): error C2143: syntax error: missing ';' before ':'
  E:\unrealprojects\cameratest\Source\cameratest\Public\OcclusionAwarePlayerController.h(35): error C2059: syntax error: ':'
  E:\unrealprojects\cameratest\Source\cameratest\Public\OcclusionAwarePlayerController.h(35): error C2059: syntax error: 'public'
  E:\unrealprojects\cameratest\Source\cameratest\Public\OcclusionAwarePlayerController.h(36): error C2143: syntax error: missing ';' before '{'
  E:\unrealprojects\cameratest\Source\cameratest\Public\OcclusionAwarePlayerController.h(36): error C2447: '{': missing function header (old-style formal list?)
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(9): error C2027: use of undefined type 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.generated.h(105): note: see declaration of 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(11): error C2065: 'CapsulePercentageForTrace': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(12): error C2065: 'DebugLineTraces': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(13): error C2065: 'IsOcclusionEnabled': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(14): error C4508: '{ctor}': function should return a value; 'void' return type assumed
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(16): error C2027: use of undefined type 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.generated.h(105): note: see declaration of 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(18): error C2653: 'Super': is not a class or namespace name
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(20): error C3861: 'GetPawn': identifier not found
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(22): error C2065: 'ActiveSpringArm': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(23): error C3861: 'GetPawn': identifier not found
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(24): error C2065: 'ActiveCamera': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(24): error C3861: 'GetPawn': identifier not found
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(25): error C2065: 'ActiveCapsuleComponent': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(26): error C3861: 'GetPawn': identifier not found
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(30): error C2027: use of undefined type 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.generated.h(105): note: see declaration of 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(32): error C3861: 'ShouldCheckCameraOcclusion': identifier not found
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(36): error C2065: 'ActiveSpringArm': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(38): error C3861: 'ForceShowOccludedActors': identifier not found
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(42): error C2065: 'ActiveCamera': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(43): error C3861: 'GetPawn': identifier not found
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(51): error C2065: 'DebugLineTraces': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(54): error C3861: 'GetWorld': identifier not found
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(54): error C2065: 'ActiveCapsuleComponent': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(54): error C2065: 'CapsulePercentageForTrace': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(55): error C2065: 'ActiveCapsuleComponent': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(55): error C2065: 'CapsulePercentageForTrace': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(57): error C3536: 'ShouldDebug': cannot be used before it is initialized
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(68): error C2039: 'Actor': is not a member of 'FHitResult'
  E:\Program Files\Epic Games\UE_5.2\Engine\Intermediate\Build\Win64\UnrealEditor\Inc\Engine\UHT\GameplayStatics.generated.h(56): note: see declaration of 'FHitResult'
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(69): error C3861: 'HideOccludedActor': identifier not found
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(74): error C2065: 'OccludedActors': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(74): error C2672: 'begin': no matching overloaded function found
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(75): error C2893: Failed to specialize function template 'unknown-type std::begin(_Container &)'
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\INCLUDE\xutility(1844): note: see declaration of 'std::begin'
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(75): note: With the following template arguments:
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(75): note: '_Container=unknown-type'
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(75): error C2784: 'const _Elem *std::begin(std::initializer_list<_Elem>) noexcept': could not deduce template argument for 'std::initializer_list<_Elem>' from 'unknown-type'
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\INCLUDE\initializer_list(55): note: see declaration of 'std::begin'
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(74): error C2672: 'end': no matching overloaded function found
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(75): error C2893: Failed to specialize function template 'unknown-type std::end(_Container &)'
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\INCLUDE\xutility(1854): note: see declaration of 'std::end'
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(75): note: With the following template arguments:
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(75): note: '_Container=unknown-type'
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(75): error C2784: 'const _Elem *std::end(std::initializer_list<_Elem>) noexcept': could not deduce template argument for 'std::initializer_list<_Elem>' from 'unknown-type'
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\INCLUDE\initializer_list(60): note: see declaration of 'std::end'
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(75): error C3536: '<begin>$L1': cannot be used before it is initialized
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(75): error C3536: '<end>$L1': cannot be used before it is initialized
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(74): error C2100: illegal indirection
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(78): error C3861: 'ShowOccludedActor': identifier not found
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(80): error C2065: 'DebugLineTraces': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(90): error C3861: 'ForceShowOccludedActors': identifier not found
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(94): error C2027: use of undefined type 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.generated.h(105): note: see declaration of 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(96): error C2065: 'OccludedActors': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(100): error C2065: 'DebugLineTraces': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(108): error C3861: 'OnHideOccludedActor': identifier not found
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(110): error C2065: 'DebugLineTraces': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(122): error C2065: 'OccludedActors': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(123): error C3861: 'OnHideOccludedActor': identifier not found
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(125): error C2065: 'DebugLineTraces': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(132): error C2027: use of undefined type 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.generated.h(105): note: see declaration of 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(134): error C2065: 'OccludedActors': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(134): error C2672: 'begin': no matching overloaded function found
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(135): error C2893: Failed to specialize function template 'unknown-type std::begin(_Container &)'
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\INCLUDE\xutility(1844): note: see declaration of 'std::begin'
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(135): note: With the following template arguments:
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(135): note: '_Container=unknown-type'
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(135): error C2784: 'const _Elem *std::begin(std::initializer_list<_Elem>) noexcept': could not deduce template argument for 'std::initializer_list<_Elem>' from 'unknown-type'
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\INCLUDE\initializer_list(55): note: see declaration of 'std::begin'
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(134): error C2672: 'end': no matching overloaded function found
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(135): error C2893: Failed to specialize function template 'unknown-type std::end(_Container &)'
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\INCLUDE\xutility(1854): note: see declaration of 'std::end'
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(135): note: With the following template arguments:
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(135): note: '_Container=unknown-type'
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(135): error C2784: 'const _Elem *std::end(std::initializer_list<_Elem>) noexcept': could not deduce template argument for 'std::initializer_list<_Elem>' from 'unknown-type'
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\INCLUDE\initializer_list(60): note: see declaration of 'std::end'
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(135): error C3536: '<begin>$L0': cannot be used before it is initialized
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(135): error C3536: '<end>$L0': cannot be used before it is initialized
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(134): error C2100: illegal indirection
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(138): error C3861: 'ShowOccludedActor': identifier not found
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(140): error C2065: 'DebugLineTraces': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(145): error C2027: use of undefined type 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.generated.h(105): note: see declaration of 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(149): error C2065: 'OccludedActors': undeclared identifier
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(153): error C3861: 'OnShowOccludedActor': identifier not found
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(156): error C2027: use of undefined type 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.generated.h(105): note: see declaration of 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(157): error C2270: 'OnShowOccludedActor': modifiers not allowed on nonmember functions
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(166): error C2027: use of undefined type 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Intermediate\Build\Win64\UnrealEditor\Inc\cameratest\UHT\OcclusionAwarePlayerController.generated.h(105): note: see declaration of 'AOcclusionAwarePlayerController'
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(167): error C2270: 'OnHideOccludedActor': modifiers not allowed on nonmember functions
  E:\unrealprojects\cameratest\Source\cameratest\Private\OcclusionAwarePlayerController.cpp(170): error C2065: 'FadeMaterial': undeclared identifier
Build failed.


@alfredbaudisch
Copy link
Author

alfredbaudisch commented Feb 17, 2024

E:\unrealprojects\cameratest\Source\cameratest\Public\OcclusionAwarePlayerController.h(35): error C2079: 'AOcclusionAwarePlayerController' uses undefined class 'DACHSHUNDSPA_API'

@pekingduck4 You can see the very first line of your error log is self-descriptive of the problem.

Change DACHSHUNDSPA_API to the name of your project class. Check your project default C++ classes to see what is the correct value, example CAMERATEST_API, etc. It all depends on the name of your project.

I need to update the article to point that out, you are not the 1st to simply copy and paste without checking the code first.

EDIT: done, updated with more info https://alfredbaudisch.com/blog/gamedev/unreal-engine-ue/unreal-engine-actors-transparent-block-camera-occlusion-see-through/

@arthurmarquis
Copy link

Hey everyone I am pretty new so any help would be appreciated.

I am getting the following errors using the above code with my game's API replaced with my project name.

image
image

Thoughts? How have I managed to screw this up?

@cinvisch
Copy link

cinvisch commented Apr 23, 2024

Hi @alfredbaudisch, thanks for this great tutorial! I managed to make it work just fine although I'm fairly new to C++.

However, Unreal always crashes when the line trace hits some actors in my map. I tried to find out why some actors become transparent without any problem, and some others make the software crash, but I had no luck so far and I'm puzzled.

In the crash report there is a reference to line 57 "ActorsJustOccluded.Add(HitActor);" and 100 "OccludedActor.Materials = StaticMesh->GetMaterials();" in the .cpp.

For line 100, the debugger sends "Unhandled exception thrown: read access violation. StaticMesh was nullptr"

At first I thought it had something to do with the material, but I tried the material of one actor that made the game crash on another actor, and it worked just fine.

Do you have any idea where this might come from?

I'm looking forward to reading from you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment