A hell of a lot of work just happened here. Don't even ask.
This commit is contained in:
parent
39d05a6435
commit
0313ff4f7f
Binary file not shown.
BIN
Content/BP_BugMarkerActor.uasset
Normal file
BIN
Content/BP_BugMarkerActor.uasset
Normal file
Binary file not shown.
Binary file not shown.
BIN
Content/IA_BugPlacerArbitraryPlacement.uasset
Normal file
BIN
Content/IA_BugPlacerArbitraryPlacement.uasset
Normal file
Binary file not shown.
Binary file not shown.
BIN
Content/MPC_Laser.uasset
Normal file
BIN
Content/MPC_Laser.uasset
Normal file
Binary file not shown.
BIN
Content/M_LaserGlow.uasset
Normal file
BIN
Content/M_LaserGlow.uasset
Normal file
Binary file not shown.
BIN
Content/M_LaserShaft.uasset
Normal file
BIN
Content/M_LaserShaft.uasset
Normal file
Binary file not shown.
BIN
Content/SM_LaserShaft.uasset
Normal file
BIN
Content/SM_LaserShaft.uasset
Normal file
Binary file not shown.
BIN
Content/T_LaserGlow.uasset
Normal file
BIN
Content/T_LaserGlow.uasset
Normal file
Binary file not shown.
BIN
Content/UI/CUI_BugCommentTextEntry.uasset
Normal file
BIN
Content/UI/CUI_BugCommentTextEntry.uasset
Normal file
Binary file not shown.
BIN
Content/UI/CUI_BugFormButton.uasset
Normal file
BIN
Content/UI/CUI_BugFormButton.uasset
Normal file
Binary file not shown.
BIN
Content/UI/CUI_BugFormOptionButton.uasset
Normal file
BIN
Content/UI/CUI_BugFormOptionButton.uasset
Normal file
Binary file not shown.
BIN
Content/UI/CUI_BugFormTextEntryButton.uasset
Normal file
BIN
Content/UI/CUI_BugFormTextEntryButton.uasset
Normal file
Binary file not shown.
BIN
Content/UI/CUI_BugSubmissionForm.uasset
Normal file
BIN
Content/UI/CUI_BugSubmissionForm.uasset
Normal file
Binary file not shown.
BIN
Content/UI/CUI_BugSummaryTextEntry.uasset
Normal file
BIN
Content/UI/CUI_BugSummaryTextEntry.uasset
Normal file
Binary file not shown.
BIN
Content/UI/CUI_Style_BugFormBorder.uasset
Normal file
BIN
Content/UI/CUI_Style_BugFormBorder.uasset
Normal file
Binary file not shown.
BIN
Content/UI/CUI_Style_BugFormButton.uasset
Normal file
BIN
Content/UI/CUI_Style_BugFormButton.uasset
Normal file
Binary file not shown.
BIN
Content/UI/CUI_Style_BugFormButtonText.uasset
Normal file
BIN
Content/UI/CUI_Style_BugFormButtonText.uasset
Normal file
Binary file not shown.
BIN
Content/UI/CUI_Style_BugFormText.uasset
Normal file
BIN
Content/UI/CUI_Style_BugFormText.uasset
Normal file
Binary file not shown.
6
Source/Unrealzilla/Private/BugMarkerActor.cpp
Normal file
6
Source/Unrealzilla/Private/BugMarkerActor.cpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
// ©2022 Batty Bovine Productions, LLC. All Rights Reserved.
|
||||||
|
|
||||||
|
#include "BugMarkerActor.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
#include "BugPlacerPawn.h"
|
#include "BugPlacerPawn.h"
|
||||||
|
|
||||||
|
#include "BugMarkerActor.h"
|
||||||
|
#include "UnrealzillaGlobalSettings.h"
|
||||||
|
|
||||||
|
#include "Components/MaterialBillboardComponent.h"
|
||||||
#include "Components/SphereComponent.h"
|
#include "Components/SphereComponent.h"
|
||||||
#include "GameFramework/Character.h"
|
#include "GameFramework/Character.h"
|
||||||
#include "GameFramework/FloatingPawnMovement.h"
|
#include "GameFramework/FloatingPawnMovement.h"
|
||||||
@ -12,14 +16,26 @@ ABugPlacerPawn::ABugPlacerPawn()
|
|||||||
{
|
{
|
||||||
this->PrimaryActorTick.bCanEverTick = true;
|
this->PrimaryActorTick.bCanEverTick = true;
|
||||||
|
|
||||||
|
this->bArbitraryPlacement = false;
|
||||||
|
this->bCurrentTraceHit = false;
|
||||||
|
|
||||||
this->SphereComponent = CreateDefaultSubobject<USphereComponent>("SphereCollision");
|
this->SphereComponent = CreateDefaultSubobject<USphereComponent>("SphereCollision");
|
||||||
this->SphereComponent->SetCollisionProfileName(UCollisionProfile::Pawn_ProfileName);
|
this->SphereComponent->SetCollisionProfileName(UCollisionProfile::Pawn_ProfileName);
|
||||||
this->SphereComponent->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_No;
|
this->SphereComponent->CanCharacterStepUpOn = ECanBeCharacterBase::ECB_No;
|
||||||
this->SphereComponent->SetShouldUpdatePhysicsVolume(true);
|
this->SphereComponent->SetShouldUpdatePhysicsVolume(true);
|
||||||
this->SphereComponent->SetCanEverAffectNavigation(false);
|
this->SphereComponent->SetCanEverAffectNavigation(false);
|
||||||
this->SphereComponent->bDynamicObstacle = true;
|
this->SphereComponent->bDynamicObstacle = false;
|
||||||
this->RootComponent = this->SphereComponent;
|
this->RootComponent = this->SphereComponent;
|
||||||
|
|
||||||
|
this->PlacementMarkerRoot = CreateDefaultSubobject<USceneComponent>("PlacementMarkerRoot");
|
||||||
|
this->PlacementMarkerRoot->AttachToComponent(this->RootComponent, FAttachmentTransformRules::KeepRelativeTransform);
|
||||||
|
|
||||||
|
this->LaserGlow = CreateDefaultSubobject<UMaterialBillboardComponent>("LaserGlow");
|
||||||
|
this->LaserGlow->AttachToComponent(this->PlacementMarkerRoot, FAttachmentTransformRules::KeepRelativeTransform);
|
||||||
|
|
||||||
|
this->TraceOriginComponent = CreateDefaultSubobject<USceneComponent>("TraceOrigin");
|
||||||
|
this->TraceOriginComponent->AttachToComponent(this->RootComponent, FAttachmentTransformRules::KeepRelativeTransform);
|
||||||
|
|
||||||
this->PawnMovement = CreateDefaultSubobject<UFloatingPawnMovement>("MovementComponent");
|
this->PawnMovement = CreateDefaultSubobject<UFloatingPawnMovement>("MovementComponent");
|
||||||
if (this->PawnMovement)
|
if (this->PawnMovement)
|
||||||
{
|
{
|
||||||
@ -34,6 +50,17 @@ void ABugPlacerPawn::BeginPlay()
|
|||||||
|
|
||||||
this->OriginalPlayer = UGameplayStatics::GetPlayerCharacter(this, 0);
|
this->OriginalPlayer = UGameplayStatics::GetPlayerCharacter(this, 0);
|
||||||
|
|
||||||
|
// Create the bug marker we will be placing.
|
||||||
|
if (this->BugPlacerBlueprintClass.IsValid())
|
||||||
|
{
|
||||||
|
FActorSpawnParameters SpawnParams;
|
||||||
|
SpawnParams.Name = TEXT("BugMarker");
|
||||||
|
SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||||
|
SpawnParams.bHideFromSceneOutliner = true;
|
||||||
|
this->BugMarker = this->GetWorld()->SpawnActor<ABugMarkerActor>(this->BugPlacerBlueprintClass.Get(), this->SphereComponent->GetComponentTransform(), SpawnParams);
|
||||||
|
this->BugMarker->AttachToComponent(this->PlacementMarkerRoot, FAttachmentTransformRules::SnapToTargetNotIncludingScale);
|
||||||
|
}
|
||||||
|
|
||||||
this->Activate();
|
this->Activate();
|
||||||
|
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
@ -47,6 +74,90 @@ void ABugPlacerPawn::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
|||||||
Super::EndPlay(EndPlayReason);
|
Super::EndPlay(EndPlayReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ABugPlacerPawn::Tick(float DeltaSeconds)
|
||||||
|
{
|
||||||
|
const UWorld *World = this->GetWorld();
|
||||||
|
|
||||||
|
if (this->bArbitraryPlacement)
|
||||||
|
{
|
||||||
|
this->TraceOriginComponent->SetVisibility(false, true);
|
||||||
|
this->PlacementMarkerRoot->SetVisibility(true, true);
|
||||||
|
this->LaserGlow->SetVisibility(false, true);
|
||||||
|
|
||||||
|
// If the debugger requests arbitrary placement, put the marker a set distance away from the camera.
|
||||||
|
this->PlacementMarkerRoot->SetRelativeLocationAndRotation(FVector(GetDefault<UUnrealzillaGlobalSettings>()->ArbitraryBugPlacementDistance, 0.0f, 0.0f), FRotator::ZeroRotator);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Under normal circumstances, we place the marker at the point where a laser hits a surface.
|
||||||
|
this->TraceOriginComponent->SetVisibility(true, true);
|
||||||
|
this->LaserGlow->SetVisibility(true, true);
|
||||||
|
|
||||||
|
FCollisionQueryParams Params;
|
||||||
|
Params.bTraceComplex = false;
|
||||||
|
Params.AddIgnoredActor(this);
|
||||||
|
|
||||||
|
FHitResult TraceHit;
|
||||||
|
const FVector TraceStart = this->TraceOriginComponent->GetComponentLocation();
|
||||||
|
const FVector TraceEnd = TraceStart + (this->TraceOriginComponent->GetForwardVector() * GetDefault<UUnrealzillaGlobalSettings>()->BugPlacementTraceDistance);
|
||||||
|
this->bCurrentTraceHit = World->LineTraceSingleByChannel(TraceHit, TraceStart, TraceEnd, ECollisionChannel::ECC_Visibility, Params);
|
||||||
|
|
||||||
|
// Move bug marker to the current pointer position, or behind
|
||||||
|
// the camera if the pointer is not currently hitting a surface.
|
||||||
|
if (this->bCurrentTraceHit)
|
||||||
|
{
|
||||||
|
this->PlacementMarkerRoot->SetWorldLocationAndRotation(TraceHit.ImpactPoint, FRotationMatrix::MakeFromZ(TraceHit.ImpactNormal).ToQuat());
|
||||||
|
this->PlacementMarkerRoot->SetVisibility(true, true);
|
||||||
|
|
||||||
|
this->TraceOriginComponent->SetRelativeScale3D(FVector(1.0f, 1.0f, (TraceHit.ImpactPoint - TraceStart).Length()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->PlacementMarkerRoot->SetRelativeLocationAndRotation(FVector::ZeroVector, FRotator::ZeroRotator);
|
||||||
|
this->PlacementMarkerRoot->SetVisibility(false, true);
|
||||||
|
|
||||||
|
this->TraceOriginComponent->SetRelativeScale3D(FVector(1.0f, 1.0f, (TraceEnd - TraceStart).Length()));
|
||||||
|
}
|
||||||
|
|
||||||
|
//#if ENABLE_DRAW_DEBUG
|
||||||
|
// if (bTraceHit && TraceHit.bBlockingHit)
|
||||||
|
// {
|
||||||
|
// // Line trace and impact point
|
||||||
|
// DrawDebugLine(World, TraceStart, TraceHit.ImpactPoint, FColor::Red, false);
|
||||||
|
// DrawDebugLine(World, TraceHit.ImpactPoint, TraceEnd, FColor::Green, false);
|
||||||
|
// DrawDebugPoint(World, TraceHit.ImpactPoint, 10.0f, FColor::Red, false);
|
||||||
|
//
|
||||||
|
// // Impact normal
|
||||||
|
// DrawDebugLine(World, TraceHit.ImpactPoint, TraceHit.ImpactPoint + (TraceHit.ImpactNormal * 50.0f), FColor(0, 100, 255, 255), false);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// // Line trace, no impact
|
||||||
|
// DrawDebugLine(World, TraceStart, TraceEnd, FColor::Red, false);
|
||||||
|
// }
|
||||||
|
//#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ABugPlacerPawn::SetArbitraryPlacement(bool bSet)
|
||||||
|
{
|
||||||
|
this->bArbitraryPlacement = bSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ABugPlacerPawn::PlaceBugMarker()
|
||||||
|
{
|
||||||
|
// If there is a surface onto which to place a bug actor, then do so here.
|
||||||
|
if (this->bArbitraryPlacement || this->bCurrentTraceHit)
|
||||||
|
{
|
||||||
|
FActorSpawnParameters SpawnParams;
|
||||||
|
SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||||
|
SpawnParams.bHideFromSceneOutliner = true;
|
||||||
|
|
||||||
|
this->GetWorld()->SpawnActor<ABugMarkerActor>(this->BugPlacerBlueprintClass.Get(), this->PlacementMarkerRoot->GetComponentTransform(), SpawnParams);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ABugPlacerPawn::Activate()
|
void ABugPlacerPawn::Activate()
|
||||||
{
|
{
|
||||||
|
|||||||
26
Source/Unrealzilla/Private/UnrealzillaGlobalSettings.cpp
Normal file
26
Source/Unrealzilla/Private/UnrealzillaGlobalSettings.cpp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// ©2022 Batty Bovine Productions, LLC. All Rights Reserved.
|
||||||
|
|
||||||
|
#include "UnrealzillaGlobalSettings.h"
|
||||||
|
|
||||||
|
|
||||||
|
void UUnrealzillaGlobalSettings::PostInitProperties()
|
||||||
|
{
|
||||||
|
Super::PostInitProperties();
|
||||||
|
}
|
||||||
|
|
||||||
|
FName UUnrealzillaGlobalSettings::GetCategoryName() const
|
||||||
|
{
|
||||||
|
return FName(TEXT("Plugins"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#if WITH_EDITOR
|
||||||
|
void UUnrealzillaGlobalSettings::PostEditChangeProperty(FPropertyChangedEvent &PropertyChangedEvent)
|
||||||
|
{
|
||||||
|
Super::PostEditChangeProperty(PropertyChangedEvent);
|
||||||
|
|
||||||
|
if (PropertyChangedEvent.Property)
|
||||||
|
{
|
||||||
|
this->ExportValuesToConsoleVariables(PropertyChangedEvent.Property);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
19
Source/Unrealzilla/Public/BugMarkerActor.h
Normal file
19
Source/Unrealzilla/Public/BugMarkerActor.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// ©2022 Batty Bovine Productions, LLC. All Rights Reserved.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
|
||||||
|
#include "BugMarkerActor.generated.h"
|
||||||
|
|
||||||
|
|
||||||
|
UCLASS()
|
||||||
|
class UNREALZILLA_API ABugMarkerActor : public AActor
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
DECLARE_DELEGATE(FMarkerResponse)
|
||||||
|
FMarkerResponse OnFormSubmit;
|
||||||
|
FMarkerResponse OnFormCancelled;
|
||||||
|
};
|
||||||
@ -19,6 +19,8 @@ public:
|
|||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
|
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
|
||||||
|
|
||||||
|
virtual void Tick(float DeltaSeconds) override;
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
void Activate();
|
void Activate();
|
||||||
|
|
||||||
@ -26,15 +28,46 @@ public:
|
|||||||
void Deactivate();
|
void Deactivate();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
void SetArbitraryPlacement(bool bSet);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
void PlaceBugMarker();
|
||||||
|
|
||||||
|
|
||||||
|
// Collision sphere, and root component
|
||||||
|
UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
|
||||||
|
TObjectPtr<class USphereComponent> SphereComponent;
|
||||||
|
|
||||||
|
// Follows the collision point of a line trace, and indicates where the bug marker will be placed.
|
||||||
|
UPROPERTY(BlueprintReadOnly, EditAnywhere)
|
||||||
|
TObjectPtr<class USceneComponent> PlacementMarkerRoot;
|
||||||
|
|
||||||
|
// The glowing end point of the laser, to indicate a surface where a marker can be placed.
|
||||||
|
UPROPERTY(BlueprintReadOnly, EditDefaultsOnly)
|
||||||
|
TObjectPtr<class UMaterialBillboardComponent> LaserGlow;
|
||||||
|
|
||||||
|
// The origin of our line trace; line extends from this origin position along the component's
|
||||||
|
// forward vector a set distance to check for surfaces where a bug marker can be placed.
|
||||||
|
UPROPERTY(BlueprintReadOnly, EditAnywhere)
|
||||||
|
TObjectPtr<class USceneComponent> TraceOriginComponent;
|
||||||
|
|
||||||
|
// Basic movement component to allow the bug placer to fly through a level.
|
||||||
|
UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
|
||||||
|
TObjectPtr<class UFloatingPawnMovement> PawnMovement;
|
||||||
|
|
||||||
|
|
||||||
|
UPROPERTY(BlueprintReadOnly, EditDefaultsOnly)
|
||||||
|
TSoftClassPtr<class ABugMarkerActor> BugPlacerBlueprintClass;
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadWrite)
|
UPROPERTY(BlueprintReadWrite)
|
||||||
float SavedMaxSpeed = 0.0f;
|
float SavedMaxSpeed = 0.0f;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, meta=(AllowPrivateAccess="true"))
|
uint8 bArbitraryPlacement : 1;
|
||||||
TObjectPtr<class USphereComponent> SphereComponent;
|
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, meta=(AllowPrivateAccess="true"))
|
uint8 bCurrentTraceHit : 1;
|
||||||
TObjectPtr<class UFloatingPawnMovement> PawnMovement;
|
|
||||||
|
|
||||||
TObjectPtr<class ACharacter> OriginalPlayer;
|
TObjectPtr<class ACharacter> OriginalPlayer;
|
||||||
|
TObjectPtr<class ABugMarkerActor> BugMarker;
|
||||||
};
|
};
|
||||||
|
|||||||
31
Source/Unrealzilla/Public/UnrealzillaGlobalSettings.h
Normal file
31
Source/Unrealzilla/Public/UnrealzillaGlobalSettings.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// ©2022 Batty Bovine Productions, LLC. All Rights Reserved.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Engine/DeveloperSettingsBackedByCVars.h"
|
||||||
|
|
||||||
|
#include "UnrealzillaGlobalSettings.generated.h"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global settings for Unrealzilla classes
|
||||||
|
*/
|
||||||
|
UCLASS(Config=Game, defaultconfig, meta = (DisplayName="Unrealzilla"))
|
||||||
|
class UNREALZILLA_API UUnrealzillaGlobalSettings : public UDeveloperSettingsBackedByCVars
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
UPROPERTY(Config, BlueprintReadOnly, EditDefaultsOnly, Category="Unrealzilla")
|
||||||
|
float BugPlacementTraceDistance = 1000.0f;
|
||||||
|
UPROPERTY(Config, BlueprintReadOnly, EditDefaultsOnly, Category="Unrealzilla")
|
||||||
|
float ArbitraryBugPlacementDistance = 250.0f;
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual void PostInitProperties() override;
|
||||||
|
virtual FName GetCategoryName() const override;
|
||||||
|
|
||||||
|
#if WITH_EDITOR
|
||||||
|
virtual void PostEditChangeProperty(struct FPropertyChangedEvent &PropertyChangedEvent) override;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
@ -31,6 +31,7 @@ namespace UnrealBuildTool.Rules
|
|||||||
"CoreUObject",
|
"CoreUObject",
|
||||||
"Engine",
|
"Engine",
|
||||||
"InputCore",
|
"InputCore",
|
||||||
|
"DeveloperSettings"
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user