Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ben Tristem
committed
Feb 22, 2016
1 parent
cb3b711
commit adfe11e
Showing
5 changed files
with
72 additions
and
4 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright Ben Tristem 2016. | ||
|
||
#include "BuildingEscape.h" | ||
#include "OpenDoor.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. | ||
bWantsBeginPlay = true; | ||
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, -60.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 ); | ||
|
||
// ... | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright Ben Tristem 2016. | ||
|
||
#pragma once | ||
|
||
#include "Components/ActorComponent.h" | ||
#include "OpenDoor.generated.h" | ||
|
||
|
||
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) ) | ||
class BUILDINGESCAPE_API UOpenDoor : public UActorComponent | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
// Sets default values for this component's properties | ||
UOpenDoor(); | ||
|
||
// Called when the game starts | ||
virtual void BeginPlay() override; | ||
|
||
// Called every frame | ||
virtual void TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction ) override; | ||
|
||
|
||
|
||
}; |
adfe11e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include "EscapeBuilding.h"
#include "OpenDoor.h"
Do I need to include something else?
opendoor.cpp is same as above, as well as .h
I am using 4.18 UE
Super::BeginPlay();
//finds the owner actor
AActor* Owner = GetOwner();
//creates the rotator
FRotator NewRotation = FRotator(0.0f, -60.0f, 0.0f);
// set door rotation
Owner->SetActorRotation(NewRotation);
get squiggly line under "Owner"->SetActorRotation(NewRotation);
with: "pointer to incomplete class type is not allowed"
adfe11e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@farmshot Make sure that you have included the proper files (IWYU) if your version is above UE 4.16. You will need to include the AActor header file found here in order for Unreal to know what you are looking for.
adfe11e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @patmilano,
Your link to the header file is down. I'm having the same problem as farmshot, above.
adfe11e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@patmilano @farmshot just add the following line to the top of your code
#include "GameFramework/Actor.h