Like the title says I’ve written the code exactly like Ben but the door just doesn’t want to rotate. I’m on Unreal Engine Version 4.26 if that’s necessary.
My Whole OpenDoor.cpp file:
// Fill out your copyright notice in the Description page of Project Settings.
#include "OpenDoor.h"
#include "Gameframework/Actor.h"
// 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.
PrimaryComponentTick.bCanEverTick = true;
// ...
}
// Called when the game starts
void UOpenDoor::BeginPlay()
{
Super::BeginPlay();
// Find the owning Actor
AActor* Owner = GetOwner();
// Create a rotator
FRotator NewRotation = FRotator(0.f, -80.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);
// ...
}
I included what Sam said some lectures ago to try and fix it but that also doesn’t help.
There aren’t any errors but the door just doesn’t move when I press play in UE.
The UE output log if necessary:
Thanks in advance.