diff --git a/Config/DefaultGame.ini b/Config/DefaultGame.ini index 25a5ff674..ffffe3d90 100644 --- a/Config/DefaultGame.ini +++ b/Config/DefaultGame.ini @@ -1,12 +1,13 @@ [/Script/EngineSettings.GeneralProjectSettings] -ProjectID=BACFB3F848AE10EDFB548D9F7BDABCA4 -ProjectName=Cloud9 +ProjectID = BACFB3F848AE10EDFB548D9F7BDABCA4 +ProjectName = Cloud9 [/Script/Cloud9.Cloud9Character] -FixedCameraPitch=-45.0 -FixedCameraDistance=1500.0 +FixedCameraPitch = -45.0 +FixedCameraDistance = 1500.0 +bIsDrawHitCursorLine = false [StartupActions] -bAddPacks=True -InsertPack=(PackSource="StarterContent.upack",PackName="StarterContent") +bAddPacks = True +InsertPack = (PackSource="StarterContent.upack",PackName="StarterContent") diff --git a/Content/Blueprints/Character/BP_Cloud9Character.uasset b/Content/Blueprints/Character/BP_Cloud9Character.uasset index 407b75846..d15e24e98 100644 Binary files a/Content/Blueprints/Character/BP_Cloud9Character.uasset and b/Content/Blueprints/Character/BP_Cloud9Character.uasset differ diff --git a/Content/Blueprints/Game/BP_Cloud9Console.uasset b/Content/Blueprints/Game/BP_Cloud9Console.uasset index adb44412f..591ce9bd9 100644 Binary files a/Content/Blueprints/Game/BP_Cloud9Console.uasset and b/Content/Blueprints/Game/BP_Cloud9Console.uasset differ diff --git a/Source/Cloud9/Character/Cloud9Character.cpp b/Source/Cloud9/Character/Cloud9Character.cpp index d95c9bcb8..b99944461 100644 --- a/Source/Cloud9/Character/Cloud9Character.cpp +++ b/Source/Cloud9/Character/Cloud9Character.cpp @@ -26,6 +26,9 @@ const FName ACloud9Character::InventoryComponentName = TEXT("Inventory"); ACloud9Character::ACloud9Character(const FObjectInitializer& ObjectInitializer) : Super( ObjectInitializer.SetDefaultSubobjectClass(CharacterMovementComponentName)) { + bIsDrawHitCursorLine = false; + bIsDrawDeprojectedCursorLine = false; + bUseControllerRotationPitch = false; bUseControllerRotationYaw = false; bUseControllerRotationRoll = false; @@ -107,38 +110,38 @@ void ACloud9Character::SetViewDirection(const FHitResult& HitResult, bool bIsHit SetCursorIsHidden(false); } - FVector WorldLocation; - FVector WorldDirection; - FVector2D MousePosition; - - GetCloud9Controller()->GetMousePosition(MousePosition.X, MousePosition.Y); - GetCloud9Controller()->DeprojectScreenPositionToWorld( - MousePosition.X, - MousePosition.Y, - WorldLocation, - WorldDirection); - - DrawDebugLine( - GetWorld(), - GetActorLocation(), - WorldLocation, - FColor::Red, - false, - /*LifeTime=*/0.0, - /*DepthPriority=*/0, - /*Thickness=*/0.f); - - DrawDebugLine( - GetWorld(), - GetActorLocation(), - HitResult.Location, - FColor::Green, - false, - /*LifeTime=*/0.0, - /*DepthPriority=*/0, - /*Thickness=*/0.f); - - // UE_LOG(LogCloud9, Display, TEXT("%s"), *HitResult.Location.ToString()); + if (bIsDrawHitCursorLine) + { + DrawDebugLine( + GetWorld(), + GetActorLocation(), + HitResult.Location, + FColor::Green, + false, + 0.0); + } + + if (bIsDrawDeprojectedCursorLine) + { + FVector WorldLocation; + FVector WorldDirection; + FVector2D MousePosition; + + GetCloud9Controller()->GetMousePosition(MousePosition.X, MousePosition.Y); + GetCloud9Controller()->DeprojectScreenPositionToWorld( + MousePosition.X, + MousePosition.Y, + WorldLocation, + WorldDirection); + + DrawDebugLine( + GetWorld(), + GetActorLocation(), + WorldLocation, + FColor::Red, + false, + 0.0); + } if (bIsHitValid) { diff --git a/Source/Cloud9/Character/Cloud9Character.h b/Source/Cloud9/Character/Cloud9Character.h index e66015247..5767875e1 100644 --- a/Source/Cloud9/Character/Cloud9Character.h +++ b/Source/Cloud9/Character/Cloud9Character.h @@ -7,7 +7,7 @@ #include "Cloud9Character.generated.h" -UCLASS(Blueprintable) +UCLASS(config=Game, Blueprintable) class ACloud9Character : public ACharacter { GENERATED_BODY() @@ -61,6 +61,21 @@ class ACloud9Character : public ACharacter UPROPERTY(BlueprintReadOnly, Category=Character) uint32 bIsSneaking : 1; + // Debug section + + UFUNCTION(BlueprintCallable) + void SetIsDrawHitCursorLine(bool Value) { bIsDrawHitCursorLine = Value; } + + UFUNCTION(BlueprintCallable) + void SetIsDrawDeprojectedCursorLine(bool Value) { bIsDrawDeprojectedCursorLine = Value; } + +protected: + UPROPERTY(Config, BlueprintReadOnly, Category = Debug) + bool bIsDrawHitCursorLine; + + UPROPERTY(Config, BlueprintReadOnly, Category = Debug) + bool bIsDrawDeprojectedCursorLine; + private: UPROPERTY(EditDefaultsOnly) UMaterial* CursorDecal;