A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
APixoVRTeleporter Class Reference

Class for VR teleporter functionality. It allows teleportation using visual indicators. More...

#include <PixoVRTeleporter.h>

Inheritance diagram for APixoVRTeleporter:
[legend]

Public Member Functions

 APixoVRTeleporter ()
 
void ActivateTeleporter (bool InActivate)
 Activate or deactivate the Teleporter.
 
void ExecuteTeleportation (UVRBaseCharacterMovementComponent *MovementComponent, const FTransform &ActorTransform, const FVector &VRLocation, const FRotator &ActorRotation)
 Execute the teleportation. It checks if there is a valid teleport destination before executing the teleportation. The teleport destination is determined based on the last valid location of the teleport cylinder.
 
virtual void GetLifetimeReplicatedProps (TArray< FLifetimeProperty > &OutLifetimeProps) const override
 
void GetTeleportationTransform (FVector &Location, FVector &ForwardVector)
 Get the teleportation transform which includes location and orientation.
 
FVector GetTeleportDestination (const FVector &OriginalLocation)
 Get the teleport destination.
 
bool IsActivated ()
 Check if the teleporter is activated.
 
void SetMotionController (UGripMotionControllerComponent *InMotionController)
 Set the motion controller that controls this Teleport.
 
void UpdateMotionControllerRotation (const FVector2D &Direction)
 Update the motion controller rotation for pad rotation.
 

Public Attributes

UStaticMeshComponentArcEndPoint
 UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)
 
USplineComponent * ArcSplineComponent
 UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)
 
UMaterialArcSplineMaterial
 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PixoVR | Teleporter", Meta = (AllowPrivateAccess = "true"))
 
UStaticMesh * ArcSplineMesh
 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PixoVR | Teleporter", Meta = (AllowPrivateAccess = "true"))
 
UStaticMeshComponentArrow
 UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)
 
bool bDrawArcSpline
 UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
 
bool bDrawTeleportArrow
 UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
 
bool bDrawTeleportCylinder
 UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
 
bool bIsTeleporterActive
 UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")
 
bool bIsValidTeleportDestination
 UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")
 
float FadeInDuration
 UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
 
float FadeOutDuration
 UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
 
UGripMotionControllerComponentMotionController
 UPROPERTY(Replicated)
 
FRotator PadRotation
 UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")
 
UStaticMeshComponentRing
 UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)
 
UStaticMeshComponentTeleportCylinder
 UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)
 
FLinearColor TeleportFadeColor
 UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
 
float TeleportLaunchVelocity
 UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
 
FRotator TeleportRotation
 UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")
 
float ThumbDeadZone
 UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")
 

Private Member Functions

virtual void BeginPlay () override
 
void ClearArc ()
 Clear the arc spline.
 
virtual void Destroyed () override
 
 GENERATED_BODY ()
 
FRotator GetRotationFromInput (const FVector2D &Direction)
 Calculate the FRotator from the pad of a controller.
 
virtual void Tick (float DeltaTime) override
 
void TickTeleporter (float DeltaTime)
 Tick the Teleporter.
 
bool TraceTeleportDestination (TArray< FVector > &TracePoints, FVector &TraceLocation, FVector &NavMeshLocation)
 Traces the teleport destination using projectile path prediction and navigation system. This function traces the teleport destination by simulating a projectile path based on the start position and launch velocity. It checks for collision with world static objects and collects the trace points along the path. If a valid hit is found, it stores the hit location in TraceLocation. Additionally, if the navigation system is available, it projects the hit location to the navigation mesh and stores the projected location in NavMeshLocation.
 
void UpdateArcEndpoint (const FVector &NewLocation, bool ValidLocationFound)
 Update the endpoint of the arc spline.
 
void UpdateArcSpline (TArray< FVector > &SplinePoints, bool ValidLocationFound)
 Update the arc spline.
 
void UpdateTeleportCylinder (const FVector &NewLocation, bool ValidLocationFound)
 Update the teleport cylinder.
 

Private Attributes

UVRBaseCharacterMovementComponentMovementComponent
 
UNavigationSystemV1 * NavigationSystem
 
TArray< USplineMeshComponent * > SplineMeshComponents
 
FVector TimedLocation
 
FRotator TimedRotation
 

Detailed Description

Class for VR teleporter functionality. It allows teleportation using visual indicators.

UCLASS()

Definition at line 27 of file PixoVRTeleporter.h.

Constructor & Destructor Documentation

◆ APixoVRTeleporter()

APixoVRTeleporter::APixoVRTeleporter ( )

Definition at line 19 of file PixoVRTeleporter.cpp.

Member Function Documentation

◆ ActivateTeleporter()

void APixoVRTeleporter::ActivateTeleporter ( bool InActivate)
BlueprintCallable

Activate or deactivate the Teleporter.

Parameters
InActivateWhether to activate or deactivate the Teleporter.

UFUNCTION(BlueprintCallable, Category = "PixoVR | Teleporter")

Definition at line 215 of file PixoVRTeleporter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BeginPlay()

void APixoVRTeleporter::BeginPlay ( )
overrideprivatevirtual

Definition at line 126 of file PixoVRTeleporter.cpp.

◆ ClearArc()

void APixoVRTeleporter::ClearArc ( )
private

Clear the arc spline.

Definition at line 248 of file PixoVRTeleporter.cpp.

Here is the caller graph for this function:

◆ Destroyed()

void APixoVRTeleporter::Destroyed ( )
overrideprivatevirtual

Definition at line 145 of file PixoVRTeleporter.cpp.

Here is the call graph for this function:

◆ ExecuteTeleportation()

void APixoVRTeleporter::ExecuteTeleportation ( UVRBaseCharacterMovementComponent * MovementComponent,
const FTransform & ActorTransform,
const FVector & VRLocation,
const FRotator & ActorRotation )
BlueprintCallable

Execute the teleportation. It checks if there is a valid teleport destination before executing the teleportation. The teleport destination is determined based on the last valid location of the teleport cylinder.

Parameters
MovementComponentThe movement component of the character.
ActorTransformThe transform of the character.
VRLocationThe HMD location (usually you can get it by GetVRLocation()).
ActorRotationThe rotation of the character.

UFUNCTION(BlueprintCallable, Category = "PixoVR | Teleporter")

Definition at line 512 of file PixoVRTeleporter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GENERATED_BODY()

APixoVRTeleporter::GENERATED_BODY ( )
private

◆ GetLifetimeReplicatedProps()

void APixoVRTeleporter::GetLifetimeReplicatedProps ( TArray< FLifetimeProperty > & OutLifetimeProps) const
overridevirtual

Definition at line 363 of file PixoVRTeleporter.cpp.

◆ GetRotationFromInput()

FRotator APixoVRTeleporter::GetRotationFromInput ( const FVector2D & Direction)
private

Calculate the FRotator from the pad of a controller.

Parameters
DirectionThe direction of the pad.
Returns
The calculated FRotator.

Definition at line 340 of file PixoVRTeleporter.cpp.

Here is the caller graph for this function:

◆ GetTeleportationTransform()

void APixoVRTeleporter::GetTeleportationTransform ( FVector & Location,
FVector & ForwardVector )
BlueprintPure

Get the teleportation transform which includes location and orientation.

Parameters
LocationThe teleportation location.
ForwardVectorThe forward vector for orientation.

UFUNCTION(BlueprintPure, Category = "PixoVR | Teleporter")

Definition at line 316 of file PixoVRTeleporter.cpp.

Here is the caller graph for this function:

◆ GetTeleportDestination()

FVector APixoVRTeleporter::GetTeleportDestination ( const FVector & OriginalLocation)
BlueprintPure

Get the teleport destination.

Parameters
OriginalLocationDesired teleport location.
Returns
The teleport destination.

UFUNCTION(BlueprintPure, Category = "PixoVR | Teleporter")

Definition at line 322 of file PixoVRTeleporter.cpp.

Here is the caller graph for this function:

◆ IsActivated()

bool APixoVRTeleporter::IsActivated ( )
BlueprintCallable

Check if the teleporter is activated.

Returns
True if the teleporter is activated, false otherwise.

UFUNCTION(BlueprintCallable, Category = "PixoVR | Teleporter")

Definition at line 121 of file PixoVRTeleporter.cpp.

Here is the caller graph for this function:

◆ SetMotionController()

void APixoVRTeleporter::SetMotionController ( UGripMotionControllerComponent * InMotionController)
BlueprintCallable

Set the motion controller that controls this Teleport.

Parameters
InMotionControllerThe motion controller component.

UFUNCTION(BlueprintCallable, Category = "PixoVR | Teleporter")

Definition at line 210 of file PixoVRTeleporter.cpp.

Here is the caller graph for this function:

◆ Tick()

void APixoVRTeleporter::Tick ( float DeltaTime)
overrideprivatevirtual

Definition at line 135 of file PixoVRTeleporter.cpp.

Here is the call graph for this function:

◆ TickTeleporter()

void APixoVRTeleporter::TickTeleporter ( float DeltaTime)
private

Tick the Teleporter.

Parameters
DeltaTimeThe delta time.

Definition at line 152 of file PixoVRTeleporter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TraceTeleportDestination()

bool APixoVRTeleporter::TraceTeleportDestination ( TArray< FVector > & TracePoints,
FVector & TraceLocation,
FVector & NavMeshLocation )
private

Traces the teleport destination using projectile path prediction and navigation system. This function traces the teleport destination by simulating a projectile path based on the start position and launch velocity. It checks for collision with world static objects and collects the trace points along the path. If a valid hit is found, it stores the hit location in TraceLocation. Additionally, if the navigation system is available, it projects the hit location to the navigation mesh and stores the projected location in NavMeshLocation.

Parameters
TracePointsArray to store the trace points along the projectile path.
TraceLocationThe hit location of the projectile path trace.
NavMeshLocationThe projected location on the navigation mesh.
Returns
True if a valid hit and navigation projection are found, false otherwise.

Definition at line 259 of file PixoVRTeleporter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateArcEndpoint()

void APixoVRTeleporter::UpdateArcEndpoint ( const FVector & NewLocation,
bool ValidLocationFound )
private

Update the endpoint of the arc spline.

Parameters
NewLocationThe new location for the endpoint.
ValidLocationFoundWhether a valid teleport location is found.

Definition at line 415 of file PixoVRTeleporter.cpp.

Here is the caller graph for this function:

◆ UpdateArcSpline()

void APixoVRTeleporter::UpdateArcSpline ( TArray< FVector > & SplinePoints,
bool ValidLocationFound )
private

Update the arc spline.

Parameters
SplinePointsThe spline points for the arc.
ValidLocationFoundWhether a valid teleport location is found.

Definition at line 421 of file PixoVRTeleporter.cpp.

Here is the caller graph for this function:

◆ UpdateMotionControllerRotation()

void APixoVRTeleporter::UpdateMotionControllerRotation ( const FVector2D & Direction)
BlueprintCallable

Update the motion controller rotation for pad rotation.

Parameters
DirectionThe motion controller pad axis direction.

UFUNCTION(BlueprintCallable, Category = "PixoVR | Teleporter")

Definition at line 330 of file PixoVRTeleporter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateTeleportCylinder()

void APixoVRTeleporter::UpdateTeleportCylinder ( const FVector & NewLocation,
bool ValidLocationFound )
private

Update the teleport cylinder.

Parameters
NewLocationThe new location for the teleport cylinder.
ValidLocationFoundWhether a valid teleport location is found.

Definition at line 370 of file PixoVRTeleporter.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ ArcEndPoint

UStaticMeshComponent* APixoVRTeleporter::ArcEndPoint
BlueprintReadWriteVisibleDefaultsOnly

UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)

Definition at line 184 of file PixoVRTeleporter.h.

◆ ArcSplineComponent

USplineComponent* APixoVRTeleporter::ArcSplineComponent
BlueprintReadWriteVisibleDefaultsOnly

UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)

Definition at line 177 of file PixoVRTeleporter.h.

◆ ArcSplineMaterial

UMaterial* APixoVRTeleporter::ArcSplineMaterial
BlueprintReadWriteEditAnywhere

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PixoVR | Teleporter", Meta = (AllowPrivateAccess = "true"))

Definition at line 219 of file PixoVRTeleporter.h.

◆ ArcSplineMesh

UStaticMesh* APixoVRTeleporter::ArcSplineMesh
BlueprintReadWriteEditAnywhere

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PixoVR | Teleporter", Meta = (AllowPrivateAccess = "true"))

Definition at line 212 of file PixoVRTeleporter.h.

◆ Arrow

UStaticMeshComponent* APixoVRTeleporter::Arrow
BlueprintReadWriteVisibleDefaultsOnly

UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)

Definition at line 205 of file PixoVRTeleporter.h.

◆ bDrawArcSpline

bool APixoVRTeleporter::bDrawArcSpline
EditAnywhere

UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")

If set to 'true' it will draw the arc spline that is used to show the direction of the teleport location.

Definition at line 250 of file PixoVRTeleporter.h.

◆ bDrawTeleportArrow

bool APixoVRTeleporter::bDrawTeleportArrow
EditAnywhere

UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")

If set to 'true' it will draw the arrow that points to the direction of the controller pad location.

Definition at line 244 of file PixoVRTeleporter.h.

◆ bDrawTeleportCylinder

bool APixoVRTeleporter::bDrawTeleportCylinder
EditAnywhere

UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")

If set to 'true' it will draw the cylinder that is used to show the area of the teleport location.

Definition at line 256 of file PixoVRTeleporter.h.

◆ bIsTeleporterActive

bool APixoVRTeleporter::bIsTeleporterActive
BlueprintReadOnly

UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")

Holds the state if the teleporter is active or not.

Definition at line 232 of file PixoVRTeleporter.h.

◆ bIsValidTeleportDestination

bool APixoVRTeleporter::bIsValidTeleportDestination
BlueprintReadOnly

UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")

Holds the state if the last teleport location is valid or not.

Definition at line 238 of file PixoVRTeleporter.h.

◆ FadeInDuration

float APixoVRTeleporter::FadeInDuration
EditAnywhere

UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")

Definition at line 286 of file PixoVRTeleporter.h.

◆ FadeOutDuration

float APixoVRTeleporter::FadeOutDuration
EditAnywhere

UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")

Definition at line 292 of file PixoVRTeleporter.h.

◆ MotionController

UGripMotionControllerComponent* APixoVRTeleporter::MotionController
Replicated

UPROPERTY(Replicated)

Definition at line 225 of file PixoVRTeleporter.h.

◆ MovementComponent

UVRBaseCharacterMovementComponent* APixoVRTeleporter::MovementComponent
private

Definition at line 305 of file PixoVRTeleporter.h.

◆ NavigationSystem

UNavigationSystemV1* APixoVRTeleporter::NavigationSystem
private

Definition at line 302 of file PixoVRTeleporter.h.

◆ PadRotation

FRotator APixoVRTeleporter::PadRotation
BlueprintReadOnly

UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")

Definition at line 268 of file PixoVRTeleporter.h.

◆ Ring

UStaticMeshComponent* APixoVRTeleporter::Ring
BlueprintReadWriteVisibleDefaultsOnly

UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)

Definition at line 198 of file PixoVRTeleporter.h.

◆ SplineMeshComponents

TArray<USplineMeshComponent*> APixoVRTeleporter::SplineMeshComponents
private

Definition at line 301 of file PixoVRTeleporter.h.

◆ TeleportCylinder

UStaticMeshComponent* APixoVRTeleporter::TeleportCylinder
BlueprintReadWriteVisibleDefaultsOnly

UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite)

Definition at line 191 of file PixoVRTeleporter.h.

◆ TeleportFadeColor

FLinearColor APixoVRTeleporter::TeleportFadeColor
EditAnywhere

UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")

Definition at line 298 of file PixoVRTeleporter.h.

◆ TeleportLaunchVelocity

float APixoVRTeleporter::TeleportLaunchVelocity
EditAnywhere

UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")

Set this to higher values to make the teleporter teleport more far away.

Definition at line 280 of file PixoVRTeleporter.h.

◆ TeleportRotation

FRotator APixoVRTeleporter::TeleportRotation
BlueprintReadOnly

UPROPERTY(BlueprintReadOnly, Category = "PixoVR | Teleporter")

Definition at line 262 of file PixoVRTeleporter.h.

◆ ThumbDeadZone

float APixoVRTeleporter::ThumbDeadZone
EditAnywhere

UPROPERTY(EditAnywhere, Category = "PixoVR | Teleporter")

This value is used to check when to create a direction arrow of the controller pad.

Definition at line 274 of file PixoVRTeleporter.h.

◆ TimedLocation

FVector APixoVRTeleporter::TimedLocation
private

Definition at line 303 of file PixoVRTeleporter.h.

◆ TimedRotation

FRotator APixoVRTeleporter::TimedRotation
private

Definition at line 304 of file PixoVRTeleporter.h.


The documentation for this class was generated from the following files: