Hello everyone,
I have created a Blueprint, where there is a static mesh and a box collision. The static mesh in this case is a door and the box collision will open it when the player overlaps it.
Now my problem is that I created an OpenDoor Component in C++, my Component needs to be associated (added as component) to the actor you want to rotate. But there’s isn’t “Add to component” to the static mesh in the blueprint. I have no way of adding my C++ component to my static mesh, here’s an image of what I’m talking about:
How can I make this work? Do I need to change my Open Door component to take a static mesh and how? Or is there a simple fix?
I have exposed my OpenDoor and CloseDoor method of my C++ component with UFUNCTION(BlueprintCallable)
My OpenDoor component header :
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class MYPROJECT_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;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
void OpenDoor(float DeltaTime);
void CloseDoor(float DelaTime);
private:
float InitialYaw;
float CurrentYaw;
UPROPERTY(EditAnywhere)
float OpenAngle = 90.0f;
UPROPERTY(EditAnywhere)
ATriggerVolume* PressurePlate;
UPROPERTY(EditAnywhere)
AActor* ActorThatOpens;
float DoorLastOpened = 0.f;
UPROPERTY(EditAnywhere)
float DoorCloseDelay = 0.5f; // half a second
UPROPERTY(EditAnywhere)
float DoorOpenSpeed = 0.8f;
UPROPERTY(EditAnywhere)
float DoorCloseSpeed = 2.0f;
};
Thank you for reading!