Documentation for the Unreal C++ Plugin
Loading...
Searching...
No Matches
TeleporterBase.h
Go to the documentation of this file.
1// Copyright(c) 2018 PixoVR, LLC. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "GameFramework/Actor.h"
7#include "Components/SplineComponent.h"
8#include "Components/SplineMeshComponent.h"
9#include "TeleporterBase.generated.h"
10
11class USplineComponent;
12
13UCLASS(Abstract)
14class PIXOCORE_API ATeleporterBase : public AActor
15{
16 GENERATED_BODY()
18public:
19 // Sets default values for this actor's properties
21
22 virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
23
24protected:
25 FVector TimedLocation;
26 FRotator TimedRotation;
27
28 // Called when the game starts or when spawned
29 virtual void BeginPlay() override;
30
31 virtual void Tick(float DeltaTime) override;
32
33 virtual void Destroyed() override;
34
35
41 virtual void UpdateArcSpline(TArray<FVector>& SplinePoints, bool ValidLocationFound);
42
48 virtual void UpdateArcEndpoint(const FVector& NewLocation, bool ValidLocationFound);
49public:
50 UPROPERTY(Replicated)
51 UGripMotionControllerComponent* MotionController;
52
53 UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")
54 bool bIsTeleporterActive;
55
56 UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")
57 bool bActivateOneTeleporterAtTime = false;
58
59 UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")
60 bool bIsValidTeleportDestination;
61
62 UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
63 bool bDrawArcSpline;
64
65 UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
66 bool bDrawTeleportArrow;
67
68 UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
69 float TeleportLaunchVelocity;
70
71 UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")
72 FRotator TeleportRotation;
73
74 UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")
75 FRotator PadRotation;
76
77 UPROPERTY(EditAnywhere, Category = "PiUpdateMotionControllerRotationxoVR | Teleporter")
78 float FadeInDuration;
79
80 UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
81 float FadeOutDuration;
82
83 UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
84 float ThumbDeadZone;
85
86 UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)
87 USplineComponent* ArcSplineComponent;
88
89 UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)
90 UStaticMeshComponent* ArcEndPoint;
91
92 UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)
93 UStaticMeshComponent* Arrow;
94
95 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PixoVR | Teleporter", Meta = (AllowPrivateAccess = "true"))
96 UStaticMesh* ArcSplineMesh;
97
98 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PixoVR | Teleporter", Meta = (AllowPrivateAccess = "true"))
99 UMaterial* ArcSplineMaterial;
100
105 UFUNCTION(BlueprintCallable, Category = "PixoVR | Teleporter")
106 virtual void UpdateMotionControllerRotation(const FVector2D& Direction);
107
112 UFUNCTION(BlueprintCallable, Category = "PixoVR | Teleporter")
113 virtual void ActivateTeleporter(bool InActivate);
114
119 UFUNCTION(BlueprintCallable, Category = "PixoVR | Teleporter")
120 virtual bool IsActivated();
121
126 UFUNCTION(BlueprintCallable, Category = "PixoVR | Teleporter")
127 virtual void SetMotionController(UGripMotionControllerComponent* InMotionController);
128
137 UFUNCTION(BlueprintCallable, Category = "PixoVR | Teleporter")
138 virtual void ExecuteTeleportation(UVRBaseCharacterMovementComponent* MovementComponent,
139 const FTransform& ActorTransform, const FVector& VRLocation,
140 const FRotator& ActorRotation) PURE_VIRTUAL(,);
141
147 UFUNCTION(BlueprintPure, Category = "PixoVR | Teleporter")
148 FVector GetTeleportDestination(const FVector& OriginalLocation);
149
155 UFUNCTION(BlueprintPure, Category = "PixoVR | Teleporter")
156 void GetTeleportationTransform(FVector& Location, FVector& ForwardVector);
157
158private:
159 TArray<USplineMeshComponent*> SplineMeshComponents;
160
165 virtual void TickTeleporter(float DeltaTime) PURE_VIRTUAL(,);
166
170 virtual void ClearArc();
171
177 FRotator GetRotationFromInput(const FVector2D& Direction);
178};
UCLASS(Abstract)
float TeleportLaunchVelocity
UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
USplineComponent * ArcSplineComponent
UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)
UStaticMeshComponent * ArcEndPoint
UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)
bool bIsValidTeleportDestination
UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")
FRotator TimedRotation
UStaticMeshComponent * Arrow
UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)
FRotator PadRotation
UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")
virtual void ExecuteTeleportation(UVRBaseCharacterMovementComponent *MovementComponent, const FTransform &ActorTransform, const FVector &VRLocation, const FRotator &ActorRotation) PURE_VIRTUAL(
Execute the teleportation. It checks if there is a valid teleport destination before executing the te...
bool bIsTeleporterActive
UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")
UStaticMesh * ArcSplineMesh
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PixoVR | Teleporter", Meta = (AllowPrivateAcc...
UGripMotionControllerComponent * MotionController
UPROPERTY(Replicated)
float FadeInDuration
UPROPERTY(EditAnywhere, Category = "PiUpdateMotionControllerRotationxoVR | Teleporter")
bool bDrawTeleportArrow
UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
TArray< USplineMeshComponent * > SplineMeshComponents
UMaterial * ArcSplineMaterial
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PixoVR | Teleporter", Meta = (AllowPrivateAcc...
float FadeOutDuration
UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
FRotator TeleportRotation
UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")
virtual void TickTeleporter(float DeltaTime) PURE_VIRTUAL(
Tick the Teleporter.
float ThumbDeadZone
UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
bool bDrawArcSpline
UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")