Updated Interaction.cpp
Script now looks for the camera on the player making it ready to start moving the camera to the items
This commit is contained in:
parent
ab2d2118dd
commit
7aa3a702d6
@ -3,8 +3,10 @@
|
||||
|
||||
#include "Interaction.h"
|
||||
|
||||
#include "NetworkMessage.h"
|
||||
#include "Chaos/BoundingVolumeUtilities.h"
|
||||
#include "Components/Button.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "Components/WidgetComponent.h"
|
||||
|
||||
|
||||
@ -77,9 +79,49 @@ void AInteraction::RemoveWidget()
|
||||
void AInteraction::CameraLeftMover()
|
||||
{
|
||||
UE_LOG(LogTemp, Display, TEXT("Button Left is being pressed"));
|
||||
TempCharacter = GetWorld()->GetFirstPlayerController()->GetCharacter();
|
||||
MainCamera = Cast<UCameraComponent>(TempCharacter->FindComponentByClass<UCameraComponent>());
|
||||
if (TempCharacter == nullptr)
|
||||
{
|
||||
UE_LOG(LogTemp, Display, TEXT("Character not found in Interaction.cpp"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogTemp, Display, TEXT("Character Found in interaction.cpp"));
|
||||
if (MainCamera == nullptr)
|
||||
{
|
||||
UE_LOG(LogTemp, Display, TEXT("Camera not found in Interaction.cpp"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogTemp, Display, TEXT("Camera functionality here in Interaction.cpp"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AInteraction::CameraRightMover()
|
||||
{
|
||||
UE_LOG(LogTemp, Display, TEXT("Button Right is being pressed"));
|
||||
TempCharacter = GetWorld()->GetFirstPlayerController()->GetCharacter();
|
||||
MainCamera = Cast<UCameraComponent>(TempCharacter->FindComponentByClass<UCameraComponent>());
|
||||
if (TempCharacter == nullptr)
|
||||
{
|
||||
UE_LOG(LogTemp, Display, TEXT("Character not found in Interaction.cpp"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogTemp, Display, TEXT("Character Found in interaction.cpp"));
|
||||
if (MainCamera == nullptr)
|
||||
{
|
||||
UE_LOG(LogTemp, Display, TEXT("Camera not found in Interaction.cpp"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogTemp, Display, TEXT("Camera functionality here in Interaction.cpp"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Camera/CameraComponent.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "Interaction.generated.h"
|
||||
|
||||
@ -50,5 +51,11 @@ public:
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category= "ButtonLeft")
|
||||
virtual void CameraRightMover();
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Camera")
|
||||
UCameraComponent* MainCamera;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Player")
|
||||
ACharacter* TempCharacter;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user