A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
VRSimpleCharacterMovementComponent.h
Go to the documentation of this file.
1// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4#include "CoreMinimal.h"
6#include "AI/Navigation/NavigationAvoidanceTypes.h"
7#include "AI/RVOAvoidanceInterface.h"
8#include "AITypes.h"
9#include "Navigation/PathFollowingComponent.h"
10#include "AI/Navigation/NavigationTypes.h"
11#include "NavigationSystem.h"
12#include "Animation/AnimationAsset.h"
13#include "Engine/EngineBaseTypes.h"
14#include "Camera/CameraComponent.h"
15#include "Engine/EngineTypes.h"
16#include "GameFramework/PawnMovementComponent.h"
17#include "Interfaces/NetworkPredictionInterface.h"
18#include "WorldCollision.h"
19#include "Runtime/Launch/Resources/Version.h"
20#include "VRSimpleCharacterMovementComponent.generated.h"
21
22class FDebugDisplayInfo;
23class ACharacter;
25//class UVRSimpleRootComponent;
26
27DECLARE_LOG_CATEGORY_EXTERN(LogSimpleCharacterMovement, Log, All);
28
30//typedef TSharedPtr<class FSavedMove_Character> FSavedMovePtr;
31
32
33//=============================================================================
47//DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FAIMoveCompletedSignature, FAIRequestID, RequestID, EPathFollowingResult::Type, Result);
48
49
50UCLASS()
52{
54public:
56 bool bIsFirstTick;
57 FVector curCameraLoc;
58 FRotator curCameraRot;
60 FVector lastCameraLoc;
61 FRotator lastCameraRot;
63 UPROPERTY(BlueprintReadOnly, Transient, Category = VRMovement)
64 UCapsuleComponent * VRRootCapsule;
65
66 UPROPERTY(BlueprintReadOnly, Transient, Category = VRMovement)
67 UCameraComponent * VRCameraComponent;
68
69 // Skips checking for the HMD location on tick, for 2D pawns when a headset is connected
70 UPROPERTY(BlueprintReadWrite, Category = VRMovement)
71 bool bSkipHMDChecks;
72
73 void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
74 void SetUpdatedComponent(USceneComponent* NewUpdatedComponent) override;
75
76 void PhysWalking(float deltaTime, int32 Iterations) override;
77 void PhysFlying(float deltaTime, int32 Iterations) override;
78 void PhysFalling(float deltaTime, int32 Iterations) override;
79 void PhysNavWalking(float deltaTime, int32 Iterations) override;
83 UVRSimpleCharacterMovementComponent(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
85 virtual bool VRClimbStepUp(const FVector& GravDir, const FVector& Delta, const FHitResult &InHit, FStepDownResult* OutStepDownResult = nullptr) override;
86
88 // Replication Functions
90 //virtual void CallServerMove(const class FSavedMove_Character* NewMove, const class FSavedMove_Character* OldMove) override;
91
92 virtual void ServerMove_PerformMovement(const FCharacterNetworkMoveData& MoveData) override;
93
95 //FCharacterNetworkMoveDataContainer VRNetworkMoveDataContainer;
96 //FCharacterMoveResponseDataContainer VRMoveResponseDataContainer;
97
98 // Use ServerMoveVR instead
99 virtual void ReplicateMoveToServer(float DeltaTime, const FVector& NewAcceleration) override;
100
101 FNetworkPredictionData_Client* GetPredictionData_Client() const override;
102 FNetworkPredictionData_Server* GetPredictionData_Server() const override;
103
105 // End Replication Functions
107};
108
109class VREXPANSIONPLUGIN_API FSavedMove_VRSimpleCharacter : public FSavedMove_VRBaseCharacter
110{
111
112public:
113
114 //FVector VRCapsuleLocation;
115 //FVector LFDiff;
116 //FVector CustomVRInputVector;
117 //FRotator VRCapsuleRotation;
118 //FVector RequestedVelocity;
119
120 void Clear();
121 virtual void SetInitialPosition(ACharacter* C);
122 virtual void PrepMoveFor(ACharacter* Character) override;
123
125 {
126 //VRCapsuleLocation = FVector::ZeroVector;
127 LFDiff = FVector::ZeroVector;
128 //CustomVRInputVector = FVector::ZeroVector;
129 //VRCapsuleRotation = FRotator::ZeroRotator;
130 //RequestedVelocity = FVector::ZeroVector;
131 }
132
133};
134
135// Need this for capsule location replication
138public:
141 {
142
143 }
144
145 FSavedMovePtr AllocateNewMove()
146 {
147 return FSavedMovePtr(new FSavedMove_VRSimpleCharacter());
148 }
150
151
152// Need this for capsule location replication?????
154{
155public:
159
160 }
161
162 FSavedMovePtr AllocateNewMove()
163 {
164 return FSavedMovePtr(new FSavedMove_VRSimpleCharacter());
165 }
DECLARE_LOG_CATEGORY_EXTERN(LogSimpleCharacterMovement, Log, All)
FNetworkPredictionData_Client_VRSimpleCharacter(const UCharacterMovementComponent &ClientMovement)
FNetworkPredictionData_Server_VRSimpleCharacter(const UCharacterMovementComponent &ClientMovement)
virtual bool VRClimbStepUp(const FVector &GravDir, const FVector &Delta, const FHitResult &InHit, FStepDownResult *OutStepDownResult=nullptr)
virtual void SetUpdatedComponent(USceneComponent *NewUpdatedComponent)
virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override
bool bSkipHMDChecks
UPROPERTY(BlueprintReadWrite, Category = VRMovement)
UCapsuleComponent * VRRootCapsule
UPROPERTY(BlueprintReadOnly, Transient, Category = VRMovement)
UCameraComponent * VRCameraComponent
UPROPERTY(BlueprintReadOnly, Transient, Category = VRMovement)