Door when Open when Actor Steps on Plate

Hello, I tried and tried, my door will not open no matter what I do when I step on the pressure plate. Here is my code

CPP http://www.hatebin.com/igbkdllboa

Header http://www.hatebin.com/dytgicqteo

Hi, Im having your same problem, 3H now trying to resolve it, but nothing!
@sampattuzzi Could you help us?
This is my code files
OpenDoor.cpp

#include "OpenDoor.h"
#include "Engine/World.h"

// Called when the game starts
// Sets default values for this component's properties
UOpenDoor::UOpenDoor()
{
	// Set this component to be initialized when the game starts, and to be ticked every frame.  You can turn these features
	// off to improve performance if you don't need them.	
}

void UOpenDoor::BeginPlay()
{
	Super::BeginPlay();
	PrimaryComponentTick.bCanEverTick = true;	
	
	ActorThatOpens = GetWorld()->GetFirstPlayerController()->GetPawn();
	
	FString ObjectName = GetOwner()->GetName();

	UE_LOG(LogTemp, Warning, TEXT("I am %s"), *ObjectName);
}

void UOpenDoor::OpenDoor()
{
	// Find the owning Actor
	AActor* Owner = GetOwner();

	// Create a rotator
	FRotator NewRotation = FRotator(0.f, 0.f, 0.f);

	// Set the door rotation
	Owner->SetActorRotation(NewRotation);
}

// Called every frame
void UOpenDoor::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
	Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

	// Poll the trigger volume
	// If the ActorThatOpens is  in the volume	
	if (PressurePlate->IsOverlappingActor(ActorThatOpens))
	{
		OpenDoor();
	}
}

OpenDoor.h

#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "Engine/TriggerVolume.h"

#include "OpenDoor.generated.h"



UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class ESCAPEROOM_API UOpenDoor : public UActorComponent
{
	GENERATED_BODY()

public:	
	// Sets default values for this component's properties
	UOpenDoor();

protected:
	// Called when the game starts
	virtual void BeginPlay() override;

	void OpenDoor();

public:			
	// Called every frame
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

private:
	UPROPERTY(VisibleAnywhere)
	float OpenAngle = 90.0f;

	UPROPERTY(EditAnywhere)		
	ATriggerVolume* PressurePlate;

	UPROPERTY(EditAnywhere)
	AActor* ActorThatOpens; // Remember pawn inherits from actor
};

Could be many things but my guess is there’s an issue with the setup of the trigger volumes. Could you screenshot the relevant settings you changed?

Privacy & Terms