Skip to content

Commit 758ba75

Browse files
committed
UE4 version 4.20.2 update and other performance and code updates
0 parents  commit 758ba75

File tree

131 files changed

+10483
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+10483
-0
lines changed

ActorLineTrace/ActorLineTrace.cpp

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Harrison McGuire
2+
// UE4 Version 4.20.2
3+
// https://github.com/Harrison1/unrealcpp
4+
// https://severallevels.io
5+
// https://harrisonmcguire.com
6+
7+
#include "ActorLineTrace.h"
8+
#include "ConstructorHelpers.h"
9+
#include "DrawDebugHelpers.h"
10+
11+
// Sets default values
12+
AActorLineTrace::AActorLineTrace()
13+
{
14+
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
15+
PrimaryActorTick.bCanEverTick = true;
16+
17+
// add cube to root
18+
Cube = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Visual Representation"));
19+
RootComponent = Cube;
20+
21+
static ConstructorHelpers::FObjectFinder<UStaticMesh> CubeAsset(TEXT("/Game/StarterContent/Shapes/Shape_Cube.Shape_Cube"));
22+
23+
if (CubeAsset.Succeeded())
24+
{
25+
Cube->SetStaticMesh(CubeAsset.Object);
26+
Cube->SetRelativeLocation(FVector(0.0f, 0.0f, 0.0f));
27+
Cube->SetWorldScale3D(FVector(1.f));
28+
}
29+
30+
// add another component in the editor to the actor to overlap with the line trace to get the event to fire
31+
32+
}
33+
34+
// Called every frame
35+
void AActorLineTrace::Tick(float DeltaTime)
36+
{
37+
Super::Tick(DeltaTime);
38+
39+
FHitResult OutHit;
40+
FVector Start = GetActorLocation();
41+
42+
Start.Z += 50.f;
43+
Start.X += 200.f;
44+
45+
FVector ForwardVector = GetActorForwardVector();
46+
FVector End = ((ForwardVector * 500.f) + Start);
47+
FCollisionQueryParams CollisionParams;
48+
CollisionParams.bTraceComplex = true;
49+
CollisionParams.AddIgnoredComponent(Cube);
50+
// or use the below to ignore the component
51+
// CollisionParams.AddIgnoredComponent_LikelyDuplicatedRoot(Cube);
52+
53+
DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 1, 0, 5);
54+
55+
if(ActorLineTraceSingle(OutHit, Start, End, ECC_WorldStatic, CollisionParams))
56+
{
57+
GEngine->AddOnScreenDebugMessage(-1, 1.f, FColor::Green, FString::Printf(TEXT("The Component Being Hit is: %s"), *OutHit.GetComponent()->GetName()));
58+
}
59+
60+
}

ActorLineTrace/ActorLineTrace.h

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Harrison McGuire
2+
// UE4 Version 4.20.2
3+
// https://github.com/Harrison1/unrealcpp
4+
// https://severallevels.io
5+
// https://harrisonmcguire.com
6+
7+
#pragma once
8+
9+
#include "CoreMinimal.h"
10+
#include "GameFramework/Actor.h"
11+
#include "ActorLineTrace.generated.h"
12+
13+
UCLASS()
14+
class UNREALCPP_API AActorLineTrace : public AActor
15+
{
16+
GENERATED_BODY()
17+
18+
public:
19+
// Sets default values for this actor's properties
20+
AActorLineTrace();
21+
22+
public:
23+
// Called every frame
24+
virtual void Tick(float DeltaTime) override;
25+
26+
UPROPERTY(EditAnywhere)
27+
UStaticMeshComponent* Cube;
28+
};

AddBillboardComp/AddBillboardComp.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Harrison McGuire
2+
// UE4 Version 4.20.2
3+
// https://github.com/Harrison1/unrealcpp
4+
// https://severallevels.io
5+
// https://harrisonmcguire.com
6+
7+
#include "AddBillboardComp.h"
8+
// include billboard comp
9+
#include "Components/BillboardComponent.h"
10+
11+
// Sets default values
12+
AAddBillboardComp::AAddBillboardComp()
13+
{
14+
MyBillboardComp = CreateDefaultSubobject<UBillboardComponent>(TEXT("Root Billboard Comp"));
15+
MyBillboardComp->SetHiddenInGame(false, true);
16+
RootComponent = MyBillboardComp;
17+
}

AddBillboardComp/AddBillboardComp.h

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Harrison McGuire
2+
// UE4 Version 4.20.2
3+
// https://github.com/Harrison1/unrealcpp
4+
// https://severallevels.io
5+
// https://harrisonmcguire.com
6+
7+
#pragma once
8+
9+
#include "CoreMinimal.h"
10+
#include "GameFramework/Actor.h"
11+
#include "AddBillboardComp.generated.h"
12+
13+
UCLASS()
14+
class UNREALCPP_API AAddBillboardComp : public AActor
15+
{
16+
GENERATED_BODY()
17+
18+
public:
19+
// Sets default values for this actor's properties
20+
AAddBillboardComp();
21+
22+
// declare point billboard comp
23+
UPROPERTY(VisibleAnywhere)
24+
class UBillboardComponent* MyBillboardComp;
25+
26+
};

0 commit comments

Comments
 (0)