5#include "CoreMinimal.h"
7#include "Engine/Classes/GameFramework/PlayerController.h"
8#include "Engine/Classes/GameFramework/PlayerState.h"
9#include "Engine/Player.h"
10#include "PhysicsEngine/PhysicsSettings.h"
11#include "Components/SkeletalMeshComponent.h"
13#if PHYSICS_INTERFACE_PHYSX
14#include "Physics/PhysScene_PhysX.h"
15#include "PhysXPublicCore.h"
17#include "PhysXIncludes.h"
20#include "Physics/PhysicsInterfaceUtils.h"
21#include "PhysicsInterfaceTypesCore.h"
22#include "PhysicsReplication.h"
24#include "Misc/ScopeRWLock.h"
26#include "GrippablePhysicsReplication.generated.h"
41struct FAsyncPhysicsRepCallbackDataVR;
42class FPhysicsReplicationAsyncCallbackVR;
54 virtual void OnTick(
float DeltaSeconds, TMap<TWeakObjectPtr<UPrimitiveComponent>, FReplicatedPhysicsTarget>& ComponentsToTargets)
override;
55 virtual bool ApplyRigidBodyState(
float DeltaSeconds, FBodyInstance* BI, FReplicatedPhysicsTarget& PhysicsTarget,
const FRigidBodyErrorCorrection& ErrorCorrection,
const float PingSecondsOneWay)
override;
58 static void ApplyAsyncDesiredStateVR(
float DeltaSeconds,
const FAsyncPhysicsRepCallbackDataVR* Input);
60 FPhysicsReplicationAsyncCallbackVR* AsyncCallbackServer;
62 void PrepareAsyncData_ExternalVR(
const FRigidBodyErrorCorrection& ErrorCorrection);
63 FAsyncPhysicsRepCallbackDataVR* CurAsyncDataVR;
64 friend FPhysicsReplicationAsyncCallback;
79 if (PhysicsReplication)
80 delete PhysicsReplication;
88 TWeakObjectPtr<UPrimitiveComponent>
Prim1;
89 TWeakObjectPtr<UPrimitiveComponent>
Prim2;
100#if PHYSICS_INTERFACE_PHYSX
101class FContactModifyCallbackVR :
public FContactModifyCallback
105 TArray<FContactModBodyInstancePair> ContactsToIgnore;
106 FRWLock RWAccessLock;
108 void onContactModify(PxContactModifyPair*
const pairs, PxU32 count)
override;
110 virtual ~FContactModifyCallbackVR()
116class FCCDContactModifyCallbackVR :
public FCCDContactModifyCallback
120 TArray<FContactModBodyInstancePair> ContactsToIgnore;
121 FRWLock RWAccessLock;
123 void onCCDContactModify(PxContactModifyPair*
const pairs, PxU32 count)
override;
125 virtual ~FCCDContactModifyCallbackVR()
131class IContactModifyCallbackFactoryVR :
public IContactModifyCallbackFactory
135 virtual FContactModifyCallback* Create(FPhysScene* OwningPhysScene)
override
137 return new FContactModifyCallbackVR();
140 virtual void Destroy(FContactModifyCallback* ContactCallback)
override
143 delete ContactCallback;
147class ICCDContactModifyCallbackFactoryVR :
public ICCDContactModifyCallbackFactory
151 virtual FCCDContactModifyCallback* Create(FPhysScene* OwningPhysScene)
override
153 return new FCCDContactModifyCallbackVR();
156 virtual void Destroy(FCCDContactModifyCallback* ContactCallback)
override
159 delete ContactCallback;
169 GENERATED_USTRUCT_BODY()
175 bool NetSerialize(FArchive& Ar, class UPackageMap* Map,
bool& bOutSuccess);
176 bool GatherActorsMovement(
AActor* OwningActor);
184 WithNetSerializer =
true,
185 WithNetSharedSerialization =
true,
189USTRUCT(BlueprintType)
196 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category =
"VRReplication")
200 UPROPERTY(EditAnywhere, NotReplicated, BlueprintReadOnly, Category = "VRReplication", meta = (ClampMin = "0", UIMin = "0", ClampMax = "100", UIMax = "100"))
203 FTimerHandle ResetReplicationHandle;
204 FTransform LastActorTransform;
205 float TimeAtInitialThrow;
206 bool bIsCurrentlyClientAuth;
209 bUseClientAuthThrowing(false),
211 LastActorTransform(FTransform::Identity),
212 TimeAtInitialThrow(0.0f),
213 bIsCurrentlyClientAuth(false)
FPhysicsReplicationVR(FPhysScene *PhysScene)
virtual bool ApplyRigidBodyState(float DeltaSeconds, FBodyInstance *BI, FReplicatedPhysicsTarget &PhysicsTarget, const FRigidBodyErrorCorrection &ErrorCorrection, const float PingSecondsOneWay) override
virtual void OnTick(float DeltaSeconds, TMap< TWeakObjectPtr< UPrimitiveComponent >, FReplicatedPhysicsTarget > &ComponentsToTargets) override
static bool IsInitialized()
virtual void Destroy(FPhysicsReplication *PhysicsReplication)
virtual FPhysicsReplication * Create(FPhysScene *OwningPhysScene)
TWeakObjectPtr< UPrimitiveComponent > Prim1
TWeakObjectPtr< UPrimitiveComponent > Prim2
FORCEINLINE bool operator==(const FContactModBodyInstancePair &Other) const
FPhysicsActorHandle Actor1
FPhysicsActorHandle Actor2
FVRClientAuthReplicationData()
int32 UpdateRate
UPROPERTY(EditAnywhere, NotReplicated, BlueprintReadOnly, Category = "VRReplication",...
FTransform LastActorTransform
bool bUseClientAuthThrowing
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VRReplication")
FTimerHandle ResetReplicationHandle
bool bIsCurrentlyClientAuth