Door Wont open

Hi, after following and fix some minor issue I face this one: my door doesnt open when overlapping the trigger volume!
So I tried to download the whole Ben project and cop[y paste the cpp and the header and still it wont work!
Maybe is something related to Unreal and it’s default settings when creating and position object in Viewport?
Im using UE Version: 4.19.2-4033788+++UE4+Release-4.19 and this is my viewport settings:
Door


VolumeTrigger
image
and this is my code
OpenDoor.cpp

#include "OpenDoor.h"
//#include "GameFramework/Actor.h"
//#include "GameFramework/PlayerController.h"
#include "Engine/World.h"
//#include "Components/ActorComponent.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
};

@sampattuzzi or @ben or anybody else could you help me?
Thank you

You seem to have the “Generate Overlap Events” unchecked for a start. It also seems to be set to block all instead of overlap all which might make more sense.

These changes are for the door or the Trigger Volume?

Anyway Im gonna use UE 4.21 and try it again cause it seems it doesnt work. Maybe could be that at the beginning I change a bracket inside Atomic.h and maybe it mess up with all the rest!
This is Trigger Volume
image
image
This is the Door
image
It’s all correct??

This looks like it should work. We are interested in the trigger volume as this is what causes the code to run.

Ok, after a long debug I discover that “maybe” it was fault of door orientation and when OpenDoor was triggered the door opened at the same angle that already was! But I’m not sure, anyway now everything works. Also I didint modify the Atomic.h file cause it’s only a IntelliSense error :smiley:
Thanks for reply!
If anybody else got this problem reply to this post and I will help you

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms