A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
PixoVRTeleporter.h
Go to the documentation of this file.
1// Copyright(c) Pixo Group. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "GameFramework/Actor.h"
7#include "PixoVRTeleporter.generated.h"
8
9class USplineComponent;
11class UMaterial;
12class UMaterialInstance;
14class UNavigationSystemV1;
15class USplineMeshComponent;
17
18DECLARE_LOG_CATEGORY_EXTERN(LogPixoVRTeleporter, Log, All);
19
24UCLASS()
25class PIXOCORE_API APixoVRTeleporter : public AActor
26{
28
29public:
31
36 UFUNCTION(BlueprintCallable, Category = "PixoVR | Teleporter")
37 void ActivateTeleporter(bool InActivate);
38
43 UFUNCTION(BlueprintCallable, Category = "PixoVR | Teleporter")
44 void UpdateMotionControllerRotation(const FVector2D& Direction);
45
51 UFUNCTION(BlueprintPure, Category = "PixoVR | Teleporter")
52 FVector GetTeleportDestination(const FVector& OriginalLocation);
53
59 UFUNCTION(BlueprintPure, Category = "PixoVR | Teleporter")
60 void GetTeleportationTransform(FVector& Location, FVector& ForwardVector);
61
66 UFUNCTION(BlueprintCallable, Category = "PixoVR | Teleporter")
67 void SetMotionController(UGripMotionControllerComponent* InMotionController);
68
73 UFUNCTION(BlueprintCallable, Category = "PixoVR | Teleporter")
74 bool IsActivated();
75
84 UFUNCTION(BlueprintCallable, Category = "PixoVR | Teleporter")
85 void ExecuteTeleportation(UVRBaseCharacterMovementComponent* MovementComponent,
86 const FTransform& ActorTransform, const FVector& VRLocation,
87 const FRotator& ActorRotation);
88
89private:
90 virtual void Tick(float DeltaTime) override;
91 virtual void BeginPlay() override;
92 virtual void Destroyed() override;
93
105 bool TraceTeleportDestination(TArray<FVector>& TracePoints, FVector& TraceLocation, FVector& NavMeshLocation);
106
110 void ClearArc();
111
117 void UpdateArcSpline(TArray<FVector>& SplinePoints, bool ValidLocationFound);
118
124 void UpdateArcEndpoint(const FVector& NewLocation, bool ValidLocationFound);
125
131 void UpdateTeleportCylinder(const FVector& NewLocation, bool ValidLocationFound);
132
137 void TickTeleporter(float DeltaTime);
138
144 FRotator GetRotationFromInput(const FVector2D& Direction);
145
146public:
147 virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
148
149 UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)
150 USplineComponent* ArcSplineComponent;
151
152 UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)
153 UStaticMeshComponent* ArcEndPoint;
154
155 UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)
156 UStaticMeshComponent* TeleportCylinder;
157
158 UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)
160
161 UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)
163
164 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PixoVR | Teleporter", Meta = (AllowPrivateAccess = "true"))
165 UStaticMesh* ArcSplineMesh;
166
167 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PixoVR | Teleporter", Meta = (AllowPrivateAccess = "true"))
168 UMaterial* ArcSplineMaterial;
169
170 UPROPERTY(Replicated)
171 UGripMotionControllerComponent* MotionController;
172
173
174 UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")
175 bool bIsTeleporterActive;
176
177 UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")
178 bool bIsValidTeleportDestination;
179
180 UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
181 bool bDrawTeleportArrow;
182
183 UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
184 bool bDrawArcSpline;
185
186 UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
187 bool bDrawTeleportCylinder;
188
189 UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")
190 FRotator TeleportRotation;
192 UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")
193 FRotator PadRotation;
194
195 UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
196 float ThumbDeadZone;
197
198 UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
199 float TeleportLaunchVelocity;
200
201 UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
202 float FadeInDuration;
203
204 UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
205 float FadeOutDuration;
206
207 UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
208 FLinearColor TeleportFadeColor;
209
210private:
211 TArray<USplineMeshComponent*> SplineMeshComponents;
212 UNavigationSystemV1* NavigationSystem;
213 FVector TimedLocation;
214 FRotator TimedRotation;
215 UVRBaseCharacterMovementComponent* MovementComponent;
216
217#if WITH_EDITOR
218 virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
219#endif
220};
DECLARE_LOG_CATEGORY_EXTERN(LogPixoVRTeleporter, Log, All)
Class for VR teleporter functionality. It allows teleportation using visual indicators.
float FadeInDuration
UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
FLinearColor TeleportFadeColor
UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
TArray< USplineMeshComponent * > SplineMeshComponents
UMaterial * ArcSplineMaterial
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PixoVR | Teleporter", Meta = (AllowPrivateAcc...
FRotator TeleportRotation
UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")
bool bIsTeleporterActive
UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")
bool bDrawTeleportCylinder
UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
bool bDrawTeleportArrow
UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
UStaticMeshComponent * ArcEndPoint
UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)
UStaticMeshComponent * Arrow
UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)
float TeleportLaunchVelocity
UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
UStaticMeshComponent * TeleportCylinder
UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)
UStaticMesh * ArcSplineMesh
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PixoVR | Teleporter", Meta = (AllowPrivateAcc...
UStaticMeshComponent * Ring
UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)
float FadeOutDuration
UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
FRotator PadRotation
UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")
UGripMotionControllerComponent * MotionController
UPROPERTY(Replicated)
UVRBaseCharacterMovementComponent * MovementComponent
bool bIsValidTeleportDestination
UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")
bool bDrawArcSpline
UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
USplineComponent * ArcSplineComponent
UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)
float ThumbDeadZone
UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
UNavigationSystemV1 * NavigationSystem
UCLASS(Blueprintable, meta = (BlueprintSpawnableComponent), ClassGroup = MotionController)