I have copied the code but he door doesnt want to move

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.

does seem odd that it is not working to me as well… I am fairly new and have taken the course not that long ago… One thing is different then the video that i can see… You get your owner before the the Rotation, Although i can not see that being a thing… I had no problems and i was also using 4.26. so it must be something small for sure. where exactly in the Video are you… that way we can reference back to exactly where you are talking about. Open all the doors! maybe something here might help

omg I’m so sorry :grinning_face_with_smiling_eyes:
somehow I didn’t add the component to the door or somehow it got disconnected.
So now I re-added it and everything works now, thx anyway though!

2 Likes

Claps Claps Good Job! Keep up the Hard work

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

Privacy & Terms