11 : MotionController(nullptr)
12 , bIsTeleporterActive(false)
13 , bIsValidTeleportDestination(false)
14 , bDrawArcSpline(true)
15 , bDrawTeleportArrow(false)
16 , TeleportLaunchVelocity(1200.f)
17 , TeleportRotation(FRotator::ZeroRotator)
18 , PadRotation(FRotator::ZeroRotator)
19 , FadeInDuration(0.25f)
20 , FadeOutDuration(0.25f)
23 PrimaryActorTick.bCanEverTick =
true;
24 PrimaryActorTick.bStartWithTickEnabled =
false;
27 SetReplicateMovement(
false);
28 bNetLoadOnClient =
false;
30 static ConstructorHelpers::FObjectFinder<UStaticMesh> ArcSplineMeshFinder(TEXT(
"StaticMesh'/PixoCore/Meshes/Controller/BeamMesh.BeamMesh'"));
33 static ConstructorHelpers::FObjectFinder<UMaterial> ArcSplineMaterialFinder(TEXT(
"Material'/PixoCore/Materials/Controller/SplineArcMaterial.SplineArcMaterial'"));
36 static ConstructorHelpers::FObjectFinder<UStaticMesh> ArcEndPointMeshFinder(TEXT(
"StaticMesh'/PixoCore/Meshes/BasicShapes/Sphere.Sphere'"));
37 UStaticMesh* ArcEndPointMesh = ArcEndPointMeshFinder.Object;
39 static ConstructorHelpers::FObjectFinder<UMaterial> ArcEndPointMaterialFinder(TEXT(
"Material'/PixoCore/Materials/Controller/ArcEndpointMaterial.ArcEndpointMaterial'"));
40 UMaterial* ArcEndPointMaterial = ArcEndPointMaterialFinder.Object;
42 USceneComponent* SceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT(
"TeleportSceneComponent"));
43 RootComponent = SceneComponent;
51 ArcEndPoint = CreateDefaultSubobject<UStaticMeshComponent>(TEXT(
"ArcEndPoint"));
53 ArcEndPoint->SetWorldScale3D(FVector(0.08f, 0.08f, 0.08f));
57 ArcEndPoint->SetCollisionProfileName(UCollisionProfile::NoCollision_ProfileName);
62 static ConstructorHelpers::FObjectFinder<UStaticMesh> CylinderArrowMeshFinder(TEXT(
"StaticMesh'/PixoCore/Meshes/Controller/BeaconDirection.BeaconDirection'"));
63 UStaticMesh* CylinderArrowMesh = CylinderArrowMeshFinder.Object;
65 Arrow = CreateDefaultSubobject<UStaticMeshComponent>(TEXT(
"Arrow"));
66 Arrow->SetupAttachment(SceneComponent);
67 Arrow->SetStaticMesh(CylinderArrowMesh);
68 Arrow->SetMaterial(0, ArcEndPointMaterial);
69 Arrow->SetCollisionProfileName(UCollisionProfile::NoCollision_ProfileName);
70 Arrow->SetGenerateOverlapEvents(
false);
71 Arrow->SetVisibility(
false,
true);
94 if(ValidLocationFound)
96 for(
auto& SplinePoint : SplinePoints)
101 ArcSplineComponent->SetSplinePointType(SplinePoints.Num() - 1, ESplinePointType::CurveClamped,
true);
107 for(int32 Index = 0; Index <= NumberOfSplinesToAdd; Index++)
109 USplineMeshComponent* SplineMeshComponent = NewObject<USplineMeshComponent>(
this);
111 SplineMeshComponent->SetMobility(EComponentMobility::Movable);
112 SplineMeshComponent->SetStartPosition(FVector(0.0f, 0.0f, 0.0f),
true);
113 SplineMeshComponent->SetStartTangent(FVector(100.0f, 0.0f, 0.0f),
true);
114 SplineMeshComponent->SetEndPosition(FVector(100.0f, 0.0f, 0.0f),
true);
115 SplineMeshComponent->SetEndTangent(FVector(100.0f, 0.0f, 0.0f),
true);
116 SplineMeshComponent->SetSplineUpDir(FVector(0.0f, 0.0f, 1.0f),
true);
117 SplineMeshComponent->SetForwardAxis(ESplineMeshAxis::X,
true);
118 SplineMeshComponent->SetStartScale(FVector2D(4, 4));
119 SplineMeshComponent->SetEndScale(FVector2D(4, 4));
122 SplineMeshComponent->SetCollisionEnabled(ECollisionEnabled::NoCollision);
123 SplineMeshComponent->SetGenerateOverlapEvents(
false);
125 FTransform Transform = FTransform(FRotator(0.0f, 0.0f, 0.0f), FVector(0.0f, 0.0f, 0.0f), FVector(1.0f, 1.0f, 1.0f));
126 SplineMeshComponent->SetRelativeTransform(Transform);
127 SplineMeshComponent->RegisterComponent();
140 SplineMeshComponent->SetVisibility(
true,
false);
142 const auto StartTangent =
ArcSplineComponent->GetTangentAtSplinePoint(Index, ESplineCoordinateSpace::Local);
143 const auto EndTangent =
ArcSplineComponent->GetTangentAtSplinePoint(Index + 1, ESplineCoordinateSpace::Local);
145 SplineMeshComponent->SetStartAndEnd(SplinePoints[Index], StartTangent, SplinePoints[Index + 1], EndTangent,
true);
150 SplineMeshComponent->SetVisibility(
false,
false);
160 SplineMeshComponent->SetVisibility(
false,
false);