Fixed Checkbox and Images showing on Buttons

This commit is contained in:
Simeon "Waldo" Wallrath 2024-08-30 15:41:10 +02:00
parent 808b378db1
commit a76678c5ba
87 changed files with 800 additions and 3518 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 5.4,
"VersionName": "5.4",
"Version": 5.3,
"VersionName": "5.3",
"FriendlyName": "OpenXRExpansionPlugin",
"Description": "An set of utility functions for OpenXR",
"Category": "Virtual Reality",
@ -31,7 +31,7 @@
{
"Name": "OpenXRExpansionEditor",
"Type": "UnCookedOnly",
"LoadingPhase": "PreDefault"
"LoadingPhase": "PostEngineInit"
}
],
"Plugins": [

View file

@ -10,9 +10,7 @@ namespace UnrealBuildTool.Rules
public OpenXRExpansionPlugin(ReadOnlyTargetRules Target)
: base(Target)
{
SetupIrisSupport(Target);
PublicDependencyModuleNames.AddRange(
PublicDependencyModuleNames.AddRange(
new string[]
{
//"InputDevice",

View file

@ -6,7 +6,6 @@
#include "MotionControllerComponent.h"
#include "OpenXRExpansionFunctionLibrary.h"
#include "Engine/NetSerialization.h"
#include "Net/Core/PushModel/PushModel.h"
#include "XRMotionControllerBase.h" // for GetHandEnumForSourceName()
//#include "EngineMinimal.h"
@ -30,13 +29,9 @@ void UOpenXRHandPoseComponent::GetLifetimeReplicatedProps(TArray< class FLifetim
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
FDoRepLifetimeParams SkipOwnerParams;
SkipOwnerParams.Condition = COND_SkipOwner;
SkipOwnerParams.bIsPushBased = true;
// Skipping the owner with this as the owner will use the controllers location directly
DOREPLIFETIME_WITH_PARAMS_FAST(UOpenXRHandPoseComponent, LeftHandRep, SkipOwnerParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UOpenXRHandPoseComponent, RightHandRep, SkipOwnerParams);
DOREPLIFETIME_CONDITION(UOpenXRHandPoseComponent, LeftHandRep, COND_SkipOwner);
DOREPLIFETIME_CONDITION(UOpenXRHandPoseComponent, RightHandRep, COND_SkipOwner);
}
void UOpenXRHandPoseComponent::Server_SendSkeletalTransforms_Implementation(const FBPXRSkeletalRepContainer& SkeletalInfo)
@ -54,9 +49,6 @@ void UOpenXRHandPoseComponent::Server_SendSkeletalTransforms_Implementation(cons
FBPXRSkeletalRepContainer::CopyReplicatedTo(SkeletalInfo, HandSkeletalActions[i]);
LeftHandRep = SkeletalInfo;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UOpenXRHandPoseComponent, LeftHandRep, this);
#endif
if (bSmoothReplicatedSkeletalData)
{
@ -72,9 +64,6 @@ void UOpenXRHandPoseComponent::Server_SendSkeletalTransforms_Implementation(cons
FBPXRSkeletalRepContainer::CopyReplicatedTo(SkeletalInfo, HandSkeletalActions[i]);
RightHandRep = SkeletalInfo;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UOpenXRHandPoseComponent, RightHandRep, this);
#endif
if (bSmoothReplicatedSkeletalData)
{

View file

@ -1,4 +1,4 @@
UE Forums Thread
UE4 Forums Thread
https://forums.unrealengine.com/development-discussion/vr-ar-development/89050-vr-openvr-expansion-plugin
Example Template Project

View file

@ -31,8 +31,6 @@
#include "AssetRegistry/AssetRegistryModule.h"
#include "AssetRegistry/ARFilter.h"
#include "FileHelpers.h"
#include "Engine/Engine.h"
#include "Editor/UnrealEdEngine.h"
#include "UnrealEdGlobals.h"
@ -78,60 +76,8 @@ void FVRGlobalSettingsDetails::CustomizeDetails(IDetailLayoutBuilder& DetailBuil
.Text(LOCTEXT("FixInvalidAnimationAssetsButton", "Fix Animation Assets"))
]
];
/*DetailBuilder.EditCategory("Utilities")
.AddCustomRow(LOCTEXT("Fix 5.4.0 Shadow Shader", "Fix Broken 5.4.0 Shadow Shader"))
.NameContent()
[
SNew(STextBlock)
.Font(IDetailLayoutBuilder::GetDetailFont())
.Text(LOCTEXT("Fix54ShadowShader", "Fix Broken 5.4.0 Shadow Shader"))
]
.ValueContent()
.MaxDesiredWidth(125.f)
.MinDesiredWidth(125.f)
[
SNew(SButton)
.ContentPadding(2)
.VAlign(VAlign_Center)
.HAlign(HAlign_Center)
.OnClicked(this, &FVRGlobalSettingsDetails::OnFixShadowShader)
[
SNew(STextBlock)
.Font(IDetailLayoutBuilder::GetDetailFont())
.Text(LOCTEXT("Fix54ShadowShaderButton", "Fix Broken 5.4.0 Shadow Shader"))
]
];*/
}
/*FReply FVRGlobalSettingsDetails::OnFixShadowShader()
{
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION == 4
FString EnginePath = FPaths::EngineDir();
EnginePath += "/Shaders/Private/ShadowProjectionPixelShader.usf";
if (FPlatformFileManager::Get().GetPlatformFile().FileExists(*EnginePath))
{
FString FileStr = "";
if (FFileHelper::LoadFileToString(FileStr, *EnginePath))
{
// Don't need to do anything complicated, the shader only contains one line with this define in it
FileStr = FileStr.Replace(TEXT("#if MOBILE_MULTI_VIEW || INSTANCED_STEREO"),TEXT("#if ((MOBILE_MULTI_VIEW || INSTANCED_STEREO) && SHADING_PATH_MOBILE)"));
FFileHelper::SaveStringToFile(FileStr, *EnginePath);
GEngine->Exec(GEngine->GetWorld(), TEXT("recompileshaders changed"));
UE_LOG(LogPath, Log, TEXT("ShadowProjectionPixelShader.usf resaved and recompiled!"));
return FReply::Handled();
}
}
#endif
UE_LOG(LogPath, Error, TEXT("ShadowProjectionPixelShader.usf could not be found, edited, or the engine version is incorrect!"));
return FReply::Handled();
}*/
FReply FVRGlobalSettingsDetails::OnCorrectInvalidAnimationAssets()
{

View file

@ -21,8 +21,6 @@ public:
FReply OnCorrectInvalidAnimationAssets();
FReply OnFixShadowShader();
void OnLockedStateUpdated(IDetailLayoutBuilder* LayoutBuilder);

View file

@ -118,7 +118,7 @@ void FSavedMove_VRBaseCharacter::SetInitialPosition(ACharacter* C)
// Instead, re-purpose it to be the capsule half height
if (AVRBaseCharacter* BaseChar = Cast<AVRBaseCharacter>(C))
{
if (BaseChar->GetVRReplicateCapsuleHeight())
if (BaseChar->VRReplicateCapsuleHeight)
CapsuleHeight = BaseChar->GetCapsuleComponent()->GetUnscaledCapsuleHalfHeight();
else
CapsuleHeight = 0.0f;

View file

@ -57,10 +57,6 @@
#include "Features/IModularFeatures.h"
#if WITH_PUSH_MODEL
#include "Net/Core/PushModel/PushModel.h"
#endif
DEFINE_LOG_CATEGORY(LogVRMotionController);
//For UE4 Profiler ~ Stat
DECLARE_CYCLE_STAT(TEXT("TickGrip ~ TickingGrip"), STAT_TickGrip, STATGROUP_TickGrip);
@ -670,25 +666,17 @@ void UGripMotionControllerComponent::GetLifetimeReplicatedProps(TArray< class FL
DISABLE_REPLICATED_PRIVATE_PROPERTY(USceneComponent, RelativeRotation);
DISABLE_REPLICATED_PRIVATE_PROPERTY(USceneComponent, RelativeScale3D);
// For std properties
FDoRepLifetimeParams PushModelParams{ COND_None, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UGripMotionControllerComponent, GrippedObjects, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UGripMotionControllerComponent, ControllerNetUpdateRate, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UGripMotionControllerComponent, bSmoothReplicatedMotion, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UGripMotionControllerComponent, bReplicateWithoutTracking, PushModelParams);
// For properties with special conditions
FDoRepLifetimeParams PushModelParamsWithCondition{ COND_SkipOwner, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
// Skipping the owner with this as the owner will use the controllers location directly
DOREPLIFETIME_WITH_PARAMS_FAST(UGripMotionControllerComponent, ReplicatedControllerTransform, PushModelParamsWithCondition);
DOREPLIFETIME_WITH_PARAMS_FAST(UGripMotionControllerComponent, LocallyGrippedObjects, PushModelParamsWithCondition);
DOREPLIFETIME_CONDITION(UGripMotionControllerComponent, ReplicatedControllerTransform, COND_SkipOwner);
DOREPLIFETIME(UGripMotionControllerComponent, GrippedObjects);
DOREPLIFETIME(UGripMotionControllerComponent, ControllerNetUpdateRate);
DOREPLIFETIME(UGripMotionControllerComponent, bSmoothReplicatedMotion);
DOREPLIFETIME(UGripMotionControllerComponent, bReplicateWithoutTracking);
// For properties with special conditions
FDoRepLifetimeParams PushModelParamsWithConditionOwnerOnly{ COND_OwnerOnly, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UGripMotionControllerComponent, LocalTransactionBuffer, PushModelParamsWithConditionOwnerOnly);
DOREPLIFETIME_CONDITION(UGripMotionControllerComponent, LocallyGrippedObjects, COND_SkipOwner);
DOREPLIFETIME_CONDITION(UGripMotionControllerComponent, LocalTransactionBuffer, COND_OwnerOnly);
// DOREPLIFETIME(UGripMotionControllerComponent, bReplicateControllerTransform);
}
@ -706,9 +694,6 @@ void UGripMotionControllerComponent::Server_SendControllerTransform_Implementati
{
// Store new transform and trigger OnRep_Function
ReplicatedControllerTransform = NewTransform;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGripMotionControllerComponent, ReplicatedControllerTransform, this);
#endif
// Server should no longer call this RPC itself, but if is using non tracked then it will so keeping auth check
if(!bHasAuthority)
@ -747,14 +732,6 @@ void UGripMotionControllerComponent::GetPhysicsVelocities(const FBPActorGripInfo
return;
}
// TMP #TODO: Fix when 5.4 bug is fixed
if (!primComp->IsSimulatingPhysics())
{
CurLinearVelocity = Grip.LinVel;
CurAngularVelocity = Grip.RotVel;
return;
}
CurAngularVelocity = primComp->GetPhysicsAngularVelocityInDegrees();
CurLinearVelocity = primComp->GetPhysicsLinearVelocity();
}
@ -1054,7 +1031,6 @@ void UGripMotionControllerComponent::SetGripCollisionType(const FBPActorGripInfo
{
GrippedObjects[fIndex].GripCollisionType = NewGripCollisionType;
ReCreateGrip(GrippedObjects[fIndex]);
DIRTY_GRIPPED_OBJECTS();
Result = EBPVRResultSwitch::OnSucceeded;
return;
}
@ -1073,7 +1049,6 @@ void UGripMotionControllerComponent::SetGripCollisionType(const FBPActorGripInfo
}
ReCreateGrip(LocallyGrippedObjects[fIndex]);
DIRTY_LOCALLY_GRIPPED_OBJECTS();
Result = EBPVRResultSwitch::OnSucceeded;
return;
@ -1090,7 +1065,6 @@ void UGripMotionControllerComponent::SetGripLateUpdateSetting(const FBPActorGrip
if (fIndex != INDEX_NONE)
{
GrippedObjects[fIndex].GripLateUpdateSetting = NewGripLateUpdateSetting;
DIRTY_GRIPPED_OBJECTS();
Result = EBPVRResultSwitch::OnSucceeded;
return;
}
@ -1108,7 +1082,6 @@ void UGripMotionControllerComponent::SetGripLateUpdateSetting(const FBPActorGrip
Server_NotifyLocalGripAddedOrChanged(GripInfo);
}
DIRTY_LOCALLY_GRIPPED_OBJECTS();
Result = EBPVRResultSwitch::OnSucceeded;
return;
}
@ -1134,8 +1107,6 @@ void UGripMotionControllerComponent::SetGripRelativeTransform(
NotifyGripTransformChanged(Grip);
}
DIRTY_GRIPPED_OBJECTS();
Result = EBPVRResultSwitch::OnSucceeded;
return;
}
@ -1158,8 +1129,6 @@ void UGripMotionControllerComponent::SetGripRelativeTransform(
Server_NotifyLocalGripAddedOrChanged(GripInfo);
}
DIRTY_LOCALLY_GRIPPED_OBJECTS();
Result = EBPVRResultSwitch::OnSucceeded;
return;
}
@ -1179,7 +1148,6 @@ void UGripMotionControllerComponent::SetGripAdditionTransform(
if (fIndex != INDEX_NONE)
{
GrippedObjects[fIndex].AdditionTransform = CreateGripRelativeAdditionTransform(Grip, NewAdditionTransform, bMakeGripRelative);
DIRTY_GRIPPED_OBJECTS();
Result = EBPVRResultSwitch::OnSucceeded;
return;
@ -1191,7 +1159,6 @@ void UGripMotionControllerComponent::SetGripAdditionTransform(
if (fIndex != INDEX_NONE)
{
LocallyGrippedObjects[fIndex].AdditionTransform = CreateGripRelativeAdditionTransform(Grip, NewAdditionTransform, bMakeGripRelative);
DIRTY_LOCALLY_GRIPPED_OBJECTS();
Result = EBPVRResultSwitch::OnSucceeded;
return;
@ -1220,8 +1187,6 @@ void UGripMotionControllerComponent::SetGripStiffnessAndDamping(
GrippedObjects[fIndex].AdvancedGripSettings.PhysicsSettings.AngularDamping = OptionalAngularDamping;
}
DIRTY_GRIPPED_OBJECTS();
Result = EBPVRResultSwitch::OnSucceeded;
SetGripConstraintStiffnessAndDamping(&GrippedObjects[fIndex]);
//return;
@ -1247,8 +1212,6 @@ void UGripMotionControllerComponent::SetGripStiffnessAndDamping(
Server_NotifyLocalGripAddedOrChanged(GripInfo);
}
DIRTY_LOCALLY_GRIPPED_OBJECTS();
Result = EBPVRResultSwitch::OnSucceeded;
SetGripConstraintStiffnessAndDamping(&LocallyGrippedObjects[fIndex]);
// return;
@ -1747,8 +1710,6 @@ bool UGripMotionControllerComponent::GripActor(
if (!bIsLocalGrip)
{
int32 Index = GrippedObjects.Add(newActorGrip);
DIRTY_GRIPPED_OBJECTS();
if (Index != INDEX_NONE)
NotifyGrip(GrippedObjects[Index]);
//NotifyGrip(newActorGrip);
@ -1758,13 +1719,9 @@ bool UGripMotionControllerComponent::GripActor(
if (!IsLocallyControlled())
{
LocalTransactionBuffer.Add(newActorGrip);
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGripMotionControllerComponent, LocalTransactionBuffer, this);
#endif
}
int32 Index = LocallyGrippedObjects.Add(newActorGrip);
DIRTY_LOCALLY_GRIPPED_OBJECTS();
if (Index != INDEX_NONE)
{
@ -2009,8 +1966,6 @@ bool UGripMotionControllerComponent::GripComponent(
if (!bIsLocalGrip)
{
int32 Index = GrippedObjects.Add(newComponentGrip);
DIRTY_GRIPPED_OBJECTS();
if (Index != INDEX_NONE)
NotifyGrip(GrippedObjects[Index]);
@ -2021,13 +1976,9 @@ bool UGripMotionControllerComponent::GripComponent(
if (!IsLocallyControlled())
{
LocalTransactionBuffer.Add(newComponentGrip);
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGripMotionControllerComponent, LocalTransactionBuffer, this);
#endif
}
int32 Index = LocallyGrippedObjects.Add(newComponentGrip);
DIRTY_LOCALLY_GRIPPED_OBJECTS();
if (Index != INDEX_NONE)
{
@ -2132,9 +2083,6 @@ bool UGripMotionControllerComponent::DropGrip_Implementation(const FBPActorGripI
if (LocalTransactionBuffer[i].GripID == Grip.GripID)
LocalTransactionBuffer.RemoveAt(i);
}
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGripMotionControllerComponent, LocalTransactionBuffer, this);
#endif
}
UPrimitiveComponent * PrimComp = nullptr;
@ -2751,8 +2699,6 @@ void UGripMotionControllerComponent::DropAndSocket_Implementation(const FBPActor
int fIndex = 0;
if (LocallyGrippedObjects.Find(NewDrop, fIndex))
{
DIRTY_LOCALLY_GRIPPED_OBJECTS();
if (HasGripAuthority(NewDrop) || IsServer())
{
LocallyGrippedObjects.RemoveAt(fIndex);
@ -2768,7 +2714,6 @@ void UGripMotionControllerComponent::DropAndSocket_Implementation(const FBPActor
fIndex = 0;
if (GrippedObjects.Find(NewDrop, fIndex))
{
DIRTY_GRIPPED_OBJECTS();
if (HasGripAuthority(NewDrop) || IsServer())
{
GrippedObjects.RemoveAt(fIndex);
@ -3124,7 +3069,7 @@ bool UGripMotionControllerComponent::NotifyGrip(FBPActorGripInformation &NewGrip
case EGripCollisionType::AttachmentGrip:
{
if (IsValid(root))
if (root)
root->SetSimulatePhysics(false);
// Move it to the correct location automatically
@ -3151,7 +3096,7 @@ bool UGripMotionControllerComponent::NotifyGrip(FBPActorGripInformation &NewGrip
default:
{
if (IsValid(root))
if (root)
{
if (root->IsSimulatingPhysics())
{
@ -3184,13 +3129,6 @@ bool UGripMotionControllerComponent::NotifyGrip(FBPActorGripInformation &NewGrip
if (!bIsReInit)
{
// TMP #TODO: Remove when 5.4 velocity bug is fixed
if (IsValid(root))
{
// Set initial world transform for velocity
NewGrip.LastVelWorldTrans = root->GetComponentTransform();
}
// Broadcast a new grip
OnGrippedObject.Broadcast(NewGrip);
if (!LocallyGrippedObjects.Contains(NewGrip.GripID) && !GrippedObjects.Contains(NewGrip.GripID))
@ -3786,14 +3724,15 @@ void UGripMotionControllerComponent::Drop_Implementation(const FBPActorGripInfor
};
// Copy over the information instead of working with a reference for the OnDroppedBroadcast
FBPActorGripInformation DropBroadcastData = NewDrop;
int fIndex = 0;
if (LocallyGrippedObjects.Find(NewDrop, fIndex))
{
DIRTY_LOCALLY_GRIPPED_OBJECTS();
if (HasGripAuthority(NewDrop) || IsServer())
{
LocallyGrippedObjects.RemoveAt(fIndex);
@ -3809,7 +3748,6 @@ void UGripMotionControllerComponent::Drop_Implementation(const FBPActorGripInfor
fIndex = 0;
if (GrippedObjects.Find(NewDrop, fIndex))
{
DIRTY_GRIPPED_OBJECTS();
if (HasGripAuthority(NewDrop) || IsServer())
{
GrippedObjects.RemoveAt(fIndex);
@ -4086,15 +4024,6 @@ bool UGripMotionControllerComponent::AddSecondaryAttachmentToGrip(const FBPActor
Server_NotifySecondaryAttachmentChanged(GripToUse->GripID, GripToUse->SecondaryGripInfo);
}
if (bWasLocal)
{
DIRTY_LOCALLY_GRIPPED_OBJECTS();
}
else
{
DIRTY_GRIPPED_OBJECTS();
}
OnSecondaryGripAdded.Broadcast(*GripToUse);
GripToUse = nullptr;
@ -4285,15 +4214,6 @@ bool UGripMotionControllerComponent::RemoveSecondaryAttachmentFromGrip(const FBP
}
if (bWasLocal)
{
DIRTY_LOCALLY_GRIPPED_OBJECTS();
}
else
{
DIRTY_GRIPPED_OBJECTS();
}
SecondaryGripIDs.Remove(GripToUse->GripID);
OnSecondaryGripRemoved.Broadcast(*GripToUse);
GripToUse = nullptr;
@ -4612,10 +4532,6 @@ bool UGripMotionControllerComponent::TeleportMoveGrip_Impl(FBPActorGripInformati
}
}
// TMP #TODO: Remove with 5.4 bug with velocity is fixed
// Reset our last world transform velocity as typically we don't want to accumulate teleport speeds into it.
Grip.LastVelWorldTrans = PrimComp->GetComponentTransform();
return true;
}
@ -4811,10 +4727,6 @@ void UGripMotionControllerComponent::UpdateTracking(float DeltaTime)
ReplicatedControllerTransform.Position = RelLoc;
ReplicatedControllerTransform.Rotation = RelRot;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGripMotionControllerComponent, ReplicatedControllerTransform, this);
#endif
// I would keep the torn off check here, except this can be checked on tick if they
// Set 100 htz updates, and in the TornOff case, it actually can't hurt any besides some small
// Perf difference.
@ -5091,22 +5003,6 @@ FVector UGripMotionControllerComponent::GetComponentVelocity() const
return Super::GetComponentVelocity();
}
// TEMP: #TODO: Remove
void UGripMotionControllerComponent::CalculateGripVelocity(FBPActorGripInformation& GripToFill, UPrimitiveComponent* ComponentToSample, float DeltaTime)
{
if (!bHasAuthority && !IsServer())
{
return;
}
FTransform CurTrans = ComponentToSample->GetComponentTransform();
GripToFill.LinVel = (CurTrans.GetLocation() - GripToFill.LastVelWorldTrans.GetLocation()) / DeltaTime;
GripToFill.RotVel = FVector::RadiansToDegrees(((CurTrans.GetRotation().ToRotationVector() - GripToFill.LastVelWorldTrans.GetRotation().ToRotationVector()))) / DeltaTime;
GripToFill.LastVelWorldTrans = CurTrans;
}
void UGripMotionControllerComponent::HandleGripArray(TArray<FBPActorGripInformation> &GrippedObjectsArray, const FTransform & ParentTransform, float DeltaTime, bool bReplicatedArray)
{
if (GrippedObjectsArray.Num())
@ -5194,8 +5090,6 @@ void UGripMotionControllerComponent::HandleGripArray(TArray<FBPActorGripInformat
else if(bActorHasInterface)
IVRGripInterface::Execute_TickGrip(actor, this, *Grip, DeltaTime);
// TEMP 5.4 (or fixed)
CalculateGripVelocity(*Grip, root, DeltaTime);
continue;
}
@ -5950,9 +5844,6 @@ void UGripMotionControllerComponent::HandleGripArray(TArray<FBPActorGripInformat
{}break;
}
// TEMP 5.4 (or fixed)
CalculateGripVelocity(*Grip, root, DeltaTime); // Technically for physical grips it would be post physics thre
// We only do this if specifically requested, it has a slight perf hit and isn't normally needed for non Custom Grip types
if (bAlwaysSendTickGrip)
{
@ -6100,7 +5991,7 @@ bool UGripMotionControllerComponent::UpdatePhysicsHandle(const FBPActorGripInfor
return true;
//#endif
//return false;
return false;
}
bool UGripMotionControllerComponent::PausePhysicsHandle(FBPActorPhysicsHandleInformation* HandleInfo)
@ -6509,7 +6400,7 @@ bool UGripMotionControllerComponent::SetUpPhysicsHandle(const FBPActorGripInform
using namespace Chaos;
// Missing from physx, not sure how it is working for them currently.
//TArray<FPhysicsActorHandle> ActorHandles;
HandleInfo->KinActorData2->GetGameThreadAPI().SetGeometry(MakeImplicitObjectPtr<TSphere<FReal, 3>>(TVector<FReal, 3>(0.f), 1000.f));
HandleInfo->KinActorData2->GetGameThreadAPI().SetGeometry(TUniquePtr<FImplicitObject>(new TSphere<FReal, 3>(TVector<FReal, 3>(0.f), 1000.f)));
HandleInfo->KinActorData2->GetGameThreadAPI().SetObjectState(EObjectStateType::Kinematic);
FPhysicsInterface::AddActorToSolver(HandleInfo->KinActorData2, ActorParams.Scene->GetSolver());
//ActorHandles.Add(HandleInfo->KinActorData2);
@ -6645,7 +6536,7 @@ bool UGripMotionControllerComponent::SetUpPhysicsHandle(const FBPActorGripInform
NewLinDrive.Stiffness = Stiffness;
NewLinDrive.MaxForce = MaxForce;
//HandleInfo->LinConstraint.bEnablePositionDrive = true;
HandleInfo->LinConstraint.bEnablePositionDrive = true;
HandleInfo->LinConstraint.XDrive = NewLinDrive;
HandleInfo->LinConstraint.YDrive = NewLinDrive;
HandleInfo->LinConstraint.ZDrive = NewLinDrive;
@ -6717,11 +6608,7 @@ bool UGripMotionControllerComponent::SetUpPhysicsHandle(const FBPActorGripInform
NewAngDrive.MaxForce = AngularMaxForce;
//NewAngDrive.MaxForce = MAX_FLT;
//HandleInfo->LinConstraint.bEnablePositionDrive = true;
HandleInfo->LinConstraint.XDrive.bEnablePositionDrive = true;
HandleInfo->LinConstraint.YDrive.bEnablePositionDrive = true;
HandleInfo->LinConstraint.ZDrive.bEnablePositionDrive = true;
HandleInfo->LinConstraint.bEnablePositionDrive = true;
HandleInfo->LinConstraint.XDrive = NewLinDrive;
HandleInfo->LinConstraint.YDrive = NewLinDrive;
HandleInfo->LinConstraint.ZDrive = NewLinDrive;
@ -7315,9 +7202,81 @@ bool UGripMotionControllerComponent::GripPollControllerState_GameThread(FVector&
bPolledHMD_GameThread = false;
}
//GripUEMotionController::FScopeLockOptional LockOptional;
TArray<IMotionController*> MotionControllers;
MotionControllers = IModularFeatures::Get().GetModularFeatureImplementations<IMotionController>(IMotionController::GetModularFeatureName());
for (auto MotionController : MotionControllers)
{
if (MotionController == nullptr)
{
continue;
}
if (bIsInGameThread)
{
EControllerHand HandType;
GetHandType(HandType);
FName GripSource = (HandType == EControllerHand::Left) ? FName("LeftGrip") : FName("RightGrip");
CurrentTrackingStatus = MotionController->GetControllerTrackingStatus(PlayerIndex, GripSource);
if (!bIgnoreTrackingStatus && CurrentTrackingStatus == ETrackingStatus::NotTracked)
continue;
}
if (MotionController->GetControllerOrientationAndPosition(PlayerIndex, MotionSource, Orientation, Position, OutbProvidedLinearVelocity, OutLinearVelocity, OutbProvidedAngularVelocity, OutAngularVelocityAsAxisAndLength, OutbProvidedLinearAcceleration, OutLinearAcceleration, WorldToMetersScale))
{
/*#if PLATFORM_PS4
// Moving this in here to work around a PSVR module bug
if (bIsInGameThread)
{
CurrentTrackingStatus = MotionController->GetControllerTrackingStatus(PlayerIndex, MotionSource);
if (CurrentTrackingStatus == ETrackingStatus::NotTracked)
continue;
}
#endif*/
if (HasTrackingParameters())
{
ApplyTrackingParameters(Position, bIsInGameThread);
}
if (bOffsetByControllerProfile)
{
FTransform FinalControllerTransform(Orientation,Position);
if (bIsInGameThread)
{
FinalControllerTransform = CurrentControllerProfileTransform * FinalControllerTransform;
}
else
{
FinalControllerTransform = LateUpdateParams.GripRenderThreadProfileTransform * FinalControllerTransform;
}
Orientation = FinalControllerTransform.Rotator();
Position = FinalControllerTransform.GetTranslation();
}
InUseMotionController = MotionController;
OnMotionControllerUpdated();
InUseMotionController = nullptr;
{
FScopeLock Lock(&PolledMotionControllerMutex);
PolledMotionController_GameThread = MotionController; // We only want a render thread update from the motion controller we polled on the game thread.
}
return true;
}
/*#if PLATFORM_PS4
else if (bIsInGameThread)
{
CurrentTrackingStatus = MotionController->GetControllerTrackingStatus(PlayerIndex, MotionSource);
}
#endif*/
}
// #NOTE: This was adding in 4.20, I presume to allow for HMDs as tracking sources for mixed reality.
// Skipping all of my special logic here for now
if (MotionSource == IMotionController::HMDSourceId || MotionSource == IMotionController::HeadSourceId)
if (MotionSource == IMotionController::HMDSourceId)
{
IXRTrackingSystem* TrackingSys = GEngine->XRSystem.Get();
if (TrackingSys)
@ -7334,81 +7293,6 @@ bool UGripMotionControllerComponent::GripPollControllerState_GameThread(FVector&
}
}
}
else
{
//GripUEMotionController::FScopeLockOptional LockOptional;
TArray<IMotionController*> MotionControllers;
MotionControllers = IModularFeatures::Get().GetModularFeatureImplementations<IMotionController>(IMotionController::GetModularFeatureName());
for (auto MotionController : MotionControllers)
{
if (MotionController == nullptr)
{
continue;
}
if (bIsInGameThread)
{
EControllerHand HandType;
GetHandType(HandType);
FName GripSource = (HandType == EControllerHand::Left) ? FName("LeftGrip") : FName("RightGrip");
CurrentTrackingStatus = MotionController->GetControllerTrackingStatus(PlayerIndex, MotionSource);
if (!bIgnoreTrackingStatus && CurrentTrackingStatus == ETrackingStatus::NotTracked)
continue;
}
if (MotionController->GetControllerOrientationAndPosition(PlayerIndex, MotionSource, Orientation, Position, OutbProvidedLinearVelocity, OutLinearVelocity, OutbProvidedAngularVelocity, OutAngularVelocityAsAxisAndLength, OutbProvidedLinearAcceleration, OutLinearAcceleration, WorldToMetersScale))
{
/*#if PLATFORM_PS4
// Moving this in here to work around a PSVR module bug
if (bIsInGameThread)
{
CurrentTrackingStatus = MotionController->GetControllerTrackingStatus(PlayerIndex, MotionSource);
if (CurrentTrackingStatus == ETrackingStatus::NotTracked)
continue;
}
#endif*/
if (HasTrackingParameters())
{
ApplyTrackingParameters(Position, bIsInGameThread);
}
if (bOffsetByControllerProfile)
{
FTransform FinalControllerTransform(Orientation, Position);
if (bIsInGameThread)
{
FinalControllerTransform = CurrentControllerProfileTransform * FinalControllerTransform;
}
else
{
FinalControllerTransform = LateUpdateParams.GripRenderThreadProfileTransform * FinalControllerTransform;
}
Orientation = FinalControllerTransform.Rotator();
Position = FinalControllerTransform.GetTranslation();
}
InUseMotionController = MotionController;
OnMotionControllerUpdated();
InUseMotionController = nullptr;
{
FScopeLock Lock(&PolledMotionControllerMutex);
PolledMotionController_GameThread = MotionController; // We only want a render thread update from the motion controller we polled on the game thread.
}
return true;
}
/*#if PLATFORM_PS4
else if (bIsInGameThread)
{
CurrentTrackingStatus = MotionController->GetControllerTrackingStatus(PlayerIndex, MotionSource);
}
#endif*/
}
}
}
return false;
}
@ -7423,7 +7307,6 @@ bool UGripMotionControllerComponent::GripPollControllerState_RenderThread(FVecto
EControllerHand HandType;
GetHandType(HandType);
FName GripSource = (HandType == EControllerHand::Left) ? FName("LeftGrip") : FName("RightGrip");
CurrentTrackingStatus = PolledMotionController_RenderThread->GetControllerTrackingStatus(PlayerIndex, GripSource);
if (PolledMotionController_RenderThread->GetControllerOrientationAndPosition(PlayerIndex, MotionSource, Orientation, Position, WorldToMetersScale))
{
@ -7759,10 +7642,6 @@ void UGripMotionControllerComponent::Server_NotifyHandledTransaction_Implementat
if(LocalTransactionBuffer[i].GripID == GripID)
LocalTransactionBuffer.RemoveAt(i);
}
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGripMotionControllerComponent, LocalTransactionBuffer, this);
#endif
}
bool UGripMotionControllerComponent::Server_NotifyLocalGripAddedOrChanged_Validate(const FBPActorGripInformation & newGrip)
@ -7772,8 +7651,6 @@ bool UGripMotionControllerComponent::Server_NotifyLocalGripAddedOrChanged_Valida
void UGripMotionControllerComponent::Server_NotifyLocalGripAddedOrChanged_Implementation(const FBPActorGripInformation & newGrip)
{
DIRTY_LOCALLY_GRIPPED_OBJECTS();
if (!newGrip.GrippedObject || newGrip.GripMovementReplicationSetting != EGripMovementReplicationSettings::ClientSide_Authoritive)
{
Client_NotifyInvalidLocalGrip(newGrip.GrippedObject, newGrip.GripID);
@ -7894,7 +7771,6 @@ void UGripMotionControllerComponent::Server_NotifyLocalGripAddedOrChanged_Implem
}
int32 NewIndex = LocallyGrippedObjects.Add(newGrip);
DIRTY_LOCALLY_GRIPPED_OBJECTS();
if (NewIndex != INDEX_NONE && LocallyGrippedObjects.Num() > 0)
{
@ -7938,8 +7814,6 @@ bool UGripMotionControllerComponent::Server_NotifyLocalGripRemoved_Validate(uint
void UGripMotionControllerComponent::Server_NotifyLocalGripRemoved_Implementation(uint8 GripID, const FTransform_NetQuantize &TransformAtDrop, FVector_NetQuantize100 OptAngularVelocity, FVector_NetQuantize100 OptLinearVelocity)
{
DIRTY_LOCALLY_GRIPPED_OBJECTS();
FBPActorGripInformation FoundGrip;
EBPVRResultSwitch Result;
GetGripByID(FoundGrip, GripID, Result);
@ -7993,7 +7867,6 @@ void UGripMotionControllerComponent::Server_NotifySecondaryAttachmentChanged_Imp
uint8 GripID,
const FBPSecondaryGripInfo& SecondaryGripInfo)
{
DIRTY_LOCALLY_GRIPPED_OBJECTS();
FBPActorGripInformation * GripInfo = LocallyGrippedObjects.FindByKey(GripID);
if (GripInfo != nullptr)
@ -8020,7 +7893,6 @@ void UGripMotionControllerComponent::Server_NotifySecondaryAttachmentChanged_Ret
uint8 GripID,
const FBPSecondaryGripInfo& SecondaryGripInfo, const FTransform_NetQuantize & NewRelativeTransform)
{
DIRTY_LOCALLY_GRIPPED_OBJECTS();
FBPActorGripInformation * GripInfo = LocallyGrippedObjects.FindByKey(GripID);
if (GripInfo != nullptr)
@ -8121,10 +7993,9 @@ void FExpandedLateUpdateManager::Setup(const FTransform& ParentToWorld, UGripMot
//void FExpandedLateUpdateManager::Apply_RenderThread(FSceneInterface* Scene, const int32 FrameNumber, const FTransform& OldRelativeTransform, const FTransform& NewRelativeTransform)
void FExpandedLateUpdateManager::Apply_RenderThread(FSceneInterface* Scene, const FTransform& OldRelativeTransform, const FTransform& NewRelativeTransform)
{
FRHICommandListBase& RHICmdList = FRHICommandListImmediate::Get();
check(IsInRenderingThread());
if (!UpdateStates[LateUpdateRenderReadIndex].Primitives.Num() || UpdateStates[LateUpdateRenderReadIndex].bSkip)
{
return;
@ -8160,7 +8031,7 @@ void FExpandedLateUpdateManager::Apply_RenderThread(FSceneInterface* Scene, cons
}
else if (CachedSceneInfo->Proxy)
{
CachedSceneInfo->Proxy->ApplyLateUpdateTransform(RHICmdList, LateUpdateTransform);
CachedSceneInfo->Proxy->ApplyLateUpdateTransform(LateUpdateTransform);
PrimitivePair.Value = -1; // Set the cached index to -1 to indicate that this primitive was already processed
/*if (FrameNumber >= 0)
{
@ -8180,7 +8051,7 @@ void FExpandedLateUpdateManager::Apply_RenderThread(FSceneInterface* Scene, cons
if (RetrievedSceneInfo->Proxy && PrimitiveIndex != nullptr && *PrimitiveIndex >= 0)*/
if (RetrievedSceneInfo->Proxy && UpdateStates[LateUpdateRenderReadIndex].Primitives.Contains(RetrievedSceneInfo) && UpdateStates[LateUpdateRenderReadIndex].Primitives[RetrievedSceneInfo] >= 0)
{
RetrievedSceneInfo->Proxy->ApplyLateUpdateTransform(RHICmdList, LateUpdateTransform);
RetrievedSceneInfo->Proxy->ApplyLateUpdateTransform(LateUpdateTransform);
/*if (FrameNumber >= 0)
{
RetrievedSceneInfo->Proxy->SetPatchingFrameNumber(FrameNumber);
@ -8399,7 +8270,7 @@ bool UGripMotionControllerComponent::GetIsComponentHeld(const UPrimitiveComponen
return (GrippedObjects.FindByKey(ComponentToCheck) || LocallyGrippedObjects.FindByKey(ComponentToCheck));
//return false;
return false;
}
bool UGripMotionControllerComponent::GetIsSecondaryAttachment(const USceneComponent * ComponentToCheck, FBPActorGripInformation & Grip)
@ -8513,81 +8384,3 @@ bool UGripMotionControllerComponent::HasAuthority() const
return bHasAuthority;
}
void UGripMotionControllerComponent::CheckTransactionBuffer()
{
if (LocalTransactionBuffer.Num())
{
for (int i = LocalTransactionBuffer.Num() - 1; i >= 0; --i)
{
if (LocalTransactionBuffer[i].ValueCache.bWasInitiallyRepped && LocalTransactionBuffer[i].GripID != LocalTransactionBuffer[i].ValueCache.CachedGripID)
{
// There appears to be a bug with TArray replication where if you replace an index with another value of that
// Index, it doesn't fully re-init the object, this is a workaround to re-zero non replicated variables
// when that happens.
LocalTransactionBuffer[i].ClearNonReppingItems();
}
if (!LocalTransactionBuffer[i].ValueCache.bWasInitiallyRepped && LocalTransactionBuffer[i].GrippedObject->IsValidLowLevelFast())
{
LocalTransactionBuffer[i].ValueCache.bWasInitiallyRepped = true;
LocalTransactionBuffer[i].ValueCache.CachedGripID = LocalTransactionBuffer[i].GripID;
int32 Index = LocallyGrippedObjects.Add(LocalTransactionBuffer[i]);
DIRTY_LOCALLY_GRIPPED_OBJECTS();
if (Index != INDEX_NONE)
{
NotifyGrip(LocallyGrippedObjects[Index]);
}
Server_NotifyHandledTransaction(LocalTransactionBuffer[i].GripID);
}
}
}
}
/////////////////////////////////////////////////
//- Push networking getter / setter functions
/////////////////////////////////////////////////
void UGripMotionControllerComponent::SetSmoothReplicatedMotion(bool bNewSmoothReplicatedMotion)
{
bSmoothReplicatedMotion = bNewSmoothReplicatedMotion;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGripMotionControllerComponent, bSmoothReplicatedMotion, this);
#endif
}
void UGripMotionControllerComponent::SetReplicateWithoutTracking(bool bNewReplicateWithoutTracking)
{
bReplicateWithoutTracking = bNewReplicateWithoutTracking;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGripMotionControllerComponent, bReplicateWithoutTracking, this);
#endif
}
void UGripMotionControllerComponent::SetControllerNetUpdateRate(float NewControllerNetUpdateRate)
{
ControllerNetUpdateRate = NewControllerNetUpdateRate;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGripMotionControllerComponent, ControllerNetUpdateRate, this);
#endif
}
void UGripMotionControllerComponent::DIRTY_GRIPPED_OBJECTS()
{
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGripMotionControllerComponent, GrippedObjects, this);
#endif
}
void UGripMotionControllerComponent::DIRTY_LOCALLY_GRIPPED_OBJECTS()
{
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGripMotionControllerComponent, LocallyGrippedObjects, this);
#endif
}
/////////////////////////////////////////////////
//- End Push networking getter / setter functions
/////////////////////////////////////////////////

View file

@ -46,12 +46,6 @@ UGS_Melee::UGS_Melee(const FObjectInitializer& ObjectInitializer) :
bOnlyPenetrateWithTwoHands = false;
}
void UGS_Melee::SetIsLodged(bool IsLodged, UPrimitiveComponent* LodgeComponent)
{
bIsLodged = IsLodged;
LodgedComponent = LodgeComponent;
}
void UGS_Melee::UpdateDualHandInfo()
{
TArray<FBPGripPair> HoldingControllers;

View file

@ -19,6 +19,7 @@
#include "Net/Core/PushModel/PushModel.h"
#endif
//=============================================================================
AGrippableActor::AGrippableActor(const FObjectInitializer& ObjectInitializer)
: Super()
@ -61,20 +62,13 @@ void AGrippableActor::GetLifetimeReplicatedProps(TArray< class FLifetimeProperty
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// For std properties
FDoRepLifetimeParams PushModelParams{ COND_None, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(AGrippableActor, bReplicateGripScripts, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(AGrippableActor, bRepGripSettingsAndGameplayTags, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(AGrippableActor, bAllowIgnoringAttachOnOwner, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(AGrippableActor, ClientAuthReplicationData, PushModelParams);
// For properties with special conditions
FDoRepLifetimeParams PushModelParamsWithCondition{ COND_Custom, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(AGrippableActor, GripLogicScripts, PushModelParamsWithCondition);
DOREPLIFETIME_WITH_PARAMS_FAST(AGrippableActor, VRGripInterfaceSettings, PushModelParamsWithCondition);
DOREPLIFETIME_WITH_PARAMS_FAST(AGrippableActor, GameplayTags, PushModelParamsWithCondition);
DOREPLIFETIME_CONDITION(AGrippableActor, GripLogicScripts, COND_Custom);
DOREPLIFETIME(AGrippableActor, bReplicateGripScripts);
DOREPLIFETIME(AGrippableActor, bRepGripSettingsAndGameplayTags);
DOREPLIFETIME(AGrippableActor, bAllowIgnoringAttachOnOwner);
DOREPLIFETIME(AGrippableActor, ClientAuthReplicationData);
DOREPLIFETIME_CONDITION(AGrippableActor, VRGripInterfaceSettings, COND_Custom);
DOREPLIFETIME_CONDITION(AGrippableActor, GameplayTags, COND_Custom);
DISABLE_REPLICATED_PRIVATE_PROPERTY(AActor, AttachmentReplication);
@ -84,6 +78,7 @@ void AGrippableActor::GetLifetimeReplicatedProps(TArray< class FLifetimeProperty
void AGrippableActor::PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker)
{
// Don't replicate if set to not do it
DOREPLIFETIME_ACTIVE_OVERRIDE_FAST(AGrippableActor, VRGripInterfaceSettings, bRepGripSettingsAndGameplayTags);
DOREPLIFETIME_ACTIVE_OVERRIDE_FAST(AGrippableActor, GameplayTags, bRepGripSettingsAndGameplayTags);
@ -852,79 +847,3 @@ void AGrippableActor::GetSubobjectsWithStableNamesForNetworking(TArray<UObject*>
}
}
}
/////////////////////////////////////////////////
//- Push networking getter / setter functions
/////////////////////////////////////////////////
void AGrippableActor::SetReplicateGripScripts(bool bNewReplicateGripScripts)
{
bReplicateGripScripts = bNewReplicateGripScripts;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableActor, bReplicateGripScripts, this);
#endif
}
TArray<TObjectPtr<UVRGripScriptBase>>& AGrippableActor::GetGripLogicScripts()
{
#if WITH_PUSH_MODEL
if (bReplicateGripScripts)
{
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableActor, GripLogicScripts, this);
}
#endif
return GripLogicScripts;
}
void AGrippableActor::SetRepGripSettingsAndGameplayTags(bool bNewRepGripSettingsAndGameplayTags)
{
bRepGripSettingsAndGameplayTags = bNewRepGripSettingsAndGameplayTags;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableActor, bRepGripSettingsAndGameplayTags, this);
#endif
}
void AGrippableActor::SetAllowIgnoringAttachOnOwner(bool bNewAllowIgnoringAttachOnOwner)
{
bAllowIgnoringAttachOnOwner = bNewAllowIgnoringAttachOnOwner;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableActor, bAllowIgnoringAttachOnOwner, this);
#endif
}
FVRClientAuthReplicationData& AGrippableActor::GetClientAuthReplicationData(FVRClientAuthReplicationData& ClientAuthData)
{
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableActor, ClientAuthReplicationData, this);
#endif
return ClientAuthReplicationData;
}
FBPInterfaceProperties& AGrippableActor::GetVRGripInterfaceSettings(bool bMarkDirty)
{
#if WITH_PUSH_MODEL
if (bMarkDirty && bRepGripSettingsAndGameplayTags)
{
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableActor, VRGripInterfaceSettings, this);
}
#endif
return VRGripInterfaceSettings;
}
FGameplayTagContainer& AGrippableActor::GetGameplayTags()
{
#if WITH_PUSH_MODEL
if (bRepGripSettingsAndGameplayTags)
{
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableActor, GameplayTags, this);
}
#endif
return GameplayTags;
}
/////////////////////////////////////////////////
//- End Push networking getter / setter functions
/////////////////////////////////////////////////

View file

@ -8,10 +8,6 @@
#include "GripScripts/VRGripScriptBase.h"
#include "Net/UnrealNetwork.h"
#if WITH_PUSH_MODEL
#include "Net/Core/PushModel/PushModel.h"
#endif
//=============================================================================
UGrippableBoxComponent::~UGrippableBoxComponent()
{
@ -51,19 +47,12 @@ void UGrippableBoxComponent::GetLifetimeReplicatedProps(TArray< class FLifetimeP
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// For std properties
FDoRepLifetimeParams PushModelParams{ COND_None, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableBoxComponent, bReplicateGripScripts, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableBoxComponent, bRepGripSettingsAndGameplayTags, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableBoxComponent, bReplicateMovement, PushModelParams);
// For properties with special conditions
FDoRepLifetimeParams PushModelParamsWithCondition{ COND_Custom, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableBoxComponent, GripLogicScripts, PushModelParamsWithCondition);
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableBoxComponent, VRGripInterfaceSettings, PushModelParamsWithCondition);
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableBoxComponent, GameplayTags, PushModelParamsWithCondition);
DOREPLIFETIME_CONDITION(UGrippableBoxComponent, GripLogicScripts, COND_Custom);
DOREPLIFETIME(UGrippableBoxComponent, bReplicateGripScripts);
DOREPLIFETIME(UGrippableBoxComponent, bRepGripSettingsAndGameplayTags);
DOREPLIFETIME(UGrippableBoxComponent, bReplicateMovement);
DOREPLIFETIME_CONDITION(UGrippableBoxComponent, VRGripInterfaceSettings, COND_Custom);
DOREPLIFETIME_CONDITION(UGrippableBoxComponent, GameplayTags, COND_Custom);
}
void UGrippableBoxComponent::PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker)
@ -332,71 +321,3 @@ void UGrippableBoxComponent::OnComponentDestroyed(bool bDestroyingHierarchy)
GripLogicScripts.Empty();
}
/////////////////////////////////////////////////
//- Push networking getter / setter functions
/////////////////////////////////////////////////
void UGrippableBoxComponent::SetReplicateGripScripts(bool bNewReplicateGripScripts)
{
bReplicateGripScripts = bNewReplicateGripScripts;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableBoxComponent, bReplicateGripScripts, this);
#endif
}
TArray<TObjectPtr<UVRGripScriptBase>>& UGrippableBoxComponent::GetGripLogicScripts()
{
#if WITH_PUSH_MODEL
if (bReplicateGripScripts)
{
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableBoxComponent, GripLogicScripts, this);
}
#endif
return GripLogicScripts;
}
void UGrippableBoxComponent::SetRepGripSettingsAndGameplayTags(bool bNewRepGripSettingsAndGameplayTags)
{
bRepGripSettingsAndGameplayTags = bNewRepGripSettingsAndGameplayTags;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableBoxComponent, bRepGripSettingsAndGameplayTags, this);
#endif
}
void UGrippableBoxComponent::SetReplicateMovement(bool bNewReplicateMovement)
{
bReplicateMovement = bNewReplicateMovement;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableBoxComponent, bReplicateMovement, this);
#endif
}
FBPInterfaceProperties& UGrippableBoxComponent::GetVRGripInterfaceSettings(bool bMarkDirty)
{
#if WITH_PUSH_MODEL
if (bMarkDirty && bRepGripSettingsAndGameplayTags)
{
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableBoxComponent, VRGripInterfaceSettings, this);
}
#endif
return VRGripInterfaceSettings;
}
FGameplayTagContainer& UGrippableBoxComponent::GetGameplayTags()
{
#if WITH_PUSH_MODEL
if (bRepGripSettingsAndGameplayTags)
{
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableBoxComponent, GameplayTags, this);
}
#endif
return GameplayTags;
}
/////////////////////////////////////////////////
//- End Push networking getter / setter functions
/////////////////////////////////////////////////

View file

@ -8,10 +8,6 @@
#include "GripScripts/VRGripScriptBase.h"
#include "Net/UnrealNetwork.h"
#if WITH_PUSH_MODEL
#include "Net/Core/PushModel/PushModel.h"
#endif
//=============================================================================
UGrippableCapsuleComponent::UGrippableCapsuleComponent(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
@ -47,19 +43,12 @@ void UGrippableCapsuleComponent::GetLifetimeReplicatedProps(TArray< class FLifet
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// For std properties
FDoRepLifetimeParams PushModelParams{ COND_None, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableCapsuleComponent, bReplicateGripScripts, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableCapsuleComponent, bRepGripSettingsAndGameplayTags, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableCapsuleComponent, bReplicateMovement, PushModelParams);
// For properties with special conditions
FDoRepLifetimeParams PushModelParamsWithCondition{ COND_Custom, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableCapsuleComponent, GripLogicScripts, PushModelParamsWithCondition);
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableCapsuleComponent, VRGripInterfaceSettings, PushModelParamsWithCondition);
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableCapsuleComponent, GameplayTags, PushModelParamsWithCondition);
DOREPLIFETIME_CONDITION(UGrippableCapsuleComponent, GripLogicScripts, COND_Custom);
DOREPLIFETIME(UGrippableCapsuleComponent, bReplicateGripScripts);
DOREPLIFETIME(UGrippableCapsuleComponent, bRepGripSettingsAndGameplayTags);
DOREPLIFETIME(UGrippableCapsuleComponent, bReplicateMovement);
DOREPLIFETIME_CONDITION(UGrippableCapsuleComponent, VRGripInterfaceSettings, COND_Custom);
DOREPLIFETIME_CONDITION(UGrippableCapsuleComponent, GameplayTags, COND_Custom);
}
void UGrippableCapsuleComponent::PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker)
@ -332,71 +321,3 @@ void UGrippableCapsuleComponent::OnComponentDestroyed(bool bDestroyingHierarchy)
GripLogicScripts.Empty();
}
/////////////////////////////////////////////////
//- Push networking getter / setter functions
/////////////////////////////////////////////////
void UGrippableCapsuleComponent::SetReplicateGripScripts(bool bNewReplicateGripScripts)
{
bReplicateGripScripts = bNewReplicateGripScripts;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableCapsuleComponent, bReplicateGripScripts, this);
#endif
}
TArray<TObjectPtr<UVRGripScriptBase>>& UGrippableCapsuleComponent::GetGripLogicScripts()
{
#if WITH_PUSH_MODEL
if (bReplicateGripScripts)
{
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableCapsuleComponent, GripLogicScripts, this);
}
#endif
return GripLogicScripts;
}
void UGrippableCapsuleComponent::SetRepGripSettingsAndGameplayTags(bool bNewRepGripSettingsAndGameplayTags)
{
bRepGripSettingsAndGameplayTags = bNewRepGripSettingsAndGameplayTags;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableCapsuleComponent, bRepGripSettingsAndGameplayTags, this);
#endif
}
void UGrippableCapsuleComponent::SetReplicateMovement(bool bNewReplicateMovement)
{
bReplicateMovement = bNewReplicateMovement;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableCapsuleComponent, bReplicateMovement, this);
#endif
}
FBPInterfaceProperties& UGrippableCapsuleComponent::GetVRGripInterfaceSettings(bool bMarkDirty)
{
#if WITH_PUSH_MODEL
if (bMarkDirty && bRepGripSettingsAndGameplayTags)
{
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableCapsuleComponent, VRGripInterfaceSettings, this);
}
#endif
return VRGripInterfaceSettings;
}
FGameplayTagContainer& UGrippableCapsuleComponent::GetGameplayTags()
{
#if WITH_PUSH_MODEL
if (bRepGripSettingsAndGameplayTags)
{
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableCapsuleComponent, GameplayTags, this);
}
#endif
return GameplayTags;
}
/////////////////////////////////////////////////
//- End Push networking getter / setter functions
/////////////////////////////////////////////////

View file

@ -37,18 +37,7 @@ void UOptionalRepSkeletalMeshComponent::GetLifetimeReplicatedProps(TArray< class
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// For std properties
FDoRepLifetimeParams PushModelParams{ COND_None, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UOptionalRepSkeletalMeshComponent, bReplicateMovement, PushModelParams);
}
void UOptionalRepSkeletalMeshComponent::SetReplicateMovement(bool bNewReplicateMovement)
{
bReplicateMovement = bNewReplicateMovement;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UOptionalRepSkeletalMeshComponent, bReplicateMovement, this);
#endif
DOREPLIFETIME(UOptionalRepSkeletalMeshComponent, bReplicateMovement);
}
void UOptionalRepSkeletalMeshComponent::GetWeldedBodies(TArray<FBodyInstance*>& OutWeldedBodies, TArray<FName>& OutLabels, bool bIncludingAutoWeld)
@ -163,20 +152,13 @@ void AGrippableSkeletalMeshActor::GetLifetimeReplicatedProps(TArray< class FLife
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// For std properties
FDoRepLifetimeParams PushModelParams{ COND_None, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(AGrippableSkeletalMeshActor, bReplicateGripScripts, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(AGrippableSkeletalMeshActor, bRepGripSettingsAndGameplayTags, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(AGrippableSkeletalMeshActor, bAllowIgnoringAttachOnOwner, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(AGrippableSkeletalMeshActor, ClientAuthReplicationData, PushModelParams);
// For properties with special conditions
FDoRepLifetimeParams PushModelParamsWithCondition{ COND_Custom, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(AGrippableSkeletalMeshActor, GripLogicScripts, PushModelParamsWithCondition);
DOREPLIFETIME_WITH_PARAMS_FAST(AGrippableSkeletalMeshActor, VRGripInterfaceSettings, PushModelParamsWithCondition);
DOREPLIFETIME_WITH_PARAMS_FAST(AGrippableSkeletalMeshActor, GameplayTags, PushModelParamsWithCondition);
DOREPLIFETIME_CONDITION(AGrippableSkeletalMeshActor, GripLogicScripts, COND_Custom);
DOREPLIFETIME(AGrippableSkeletalMeshActor, bReplicateGripScripts);
DOREPLIFETIME(AGrippableSkeletalMeshActor, bRepGripSettingsAndGameplayTags);
DOREPLIFETIME(AGrippableSkeletalMeshActor, bAllowIgnoringAttachOnOwner);
DOREPLIFETIME(AGrippableSkeletalMeshActor, ClientAuthReplicationData);
DOREPLIFETIME_CONDITION(AGrippableSkeletalMeshActor, VRGripInterfaceSettings, COND_Custom);
DOREPLIFETIME_CONDITION(AGrippableSkeletalMeshActor, GameplayTags, COND_Custom);
DISABLE_REPLICATED_PRIVATE_PROPERTY(AActor, AttachmentReplication);
@ -950,79 +932,3 @@ void AGrippableSkeletalMeshActor::GetSubobjectsWithStableNamesForNetworking(TArr
}
}
}
/////////////////////////////////////////////////
//- Push networking getter / setter functions
/////////////////////////////////////////////////
void AGrippableSkeletalMeshActor::SetReplicateGripScripts(bool bNewReplicateGripScripts)
{
bReplicateGripScripts = bNewReplicateGripScripts;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableSkeletalMeshActor, bReplicateGripScripts, this);
#endif
}
TArray<TObjectPtr<UVRGripScriptBase>>& AGrippableSkeletalMeshActor::GetGripLogicScripts()
{
#if WITH_PUSH_MODEL
if (bReplicateGripScripts)
{
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableSkeletalMeshActor, GripLogicScripts, this);
}
#endif
return GripLogicScripts;
}
void AGrippableSkeletalMeshActor::SetRepGripSettingsAndGameplayTags(bool bNewRepGripSettingsAndGameplayTags)
{
bRepGripSettingsAndGameplayTags = bNewRepGripSettingsAndGameplayTags;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableSkeletalMeshActor, bRepGripSettingsAndGameplayTags, this);
#endif
}
void AGrippableSkeletalMeshActor::SetAllowIgnoringAttachOnOwner(bool bNewAllowIgnoringAttachOnOwner)
{
bAllowIgnoringAttachOnOwner = bNewAllowIgnoringAttachOnOwner;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableSkeletalMeshActor, bAllowIgnoringAttachOnOwner, this);
#endif
}
FVRClientAuthReplicationData& AGrippableSkeletalMeshActor::GetClientAuthReplicationData(FVRClientAuthReplicationData& ClientAuthData)
{
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableSkeletalMeshActor, ClientAuthReplicationData, this);
#endif
return ClientAuthReplicationData;
}
FBPInterfaceProperties& AGrippableSkeletalMeshActor::GetVRGripInterfaceSettings(bool bMarkDirty)
{
#if WITH_PUSH_MODEL
if (bMarkDirty && bRepGripSettingsAndGameplayTags)
{
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableSkeletalMeshActor, VRGripInterfaceSettings, this);
}
#endif
return VRGripInterfaceSettings;
}
FGameplayTagContainer& AGrippableSkeletalMeshActor::GetGameplayTags()
{
#if WITH_PUSH_MODEL
if (bRepGripSettingsAndGameplayTags)
{
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableSkeletalMeshActor, GameplayTags, this);
}
#endif
return GameplayTags;
}
/////////////////////////////////////////////////
//- End Push networking getter / setter functions
/////////////////////////////////////////////////

View file

@ -8,9 +8,6 @@
#include "GripScripts/VRGripScriptBase.h"
#include "PhysicsEngine/PhysicsAsset.h" // Tmp until epic bug fixes skeletal welding
#include "Net/UnrealNetwork.h"
#if WITH_PUSH_MODEL
#include "Net/Core/PushModel/PushModel.h"
#endif
//=============================================================================
UGrippableSkeletalMeshComponent::UGrippableSkeletalMeshComponent(const FObjectInitializer& ObjectInitializer)
@ -47,19 +44,12 @@ void UGrippableSkeletalMeshComponent::GetLifetimeReplicatedProps(TArray< class F
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// For std properties
FDoRepLifetimeParams PushModelParams{ COND_None, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableSkeletalMeshComponent, bReplicateGripScripts, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableSkeletalMeshComponent, bRepGripSettingsAndGameplayTags, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableSkeletalMeshComponent, bReplicateMovement, PushModelParams);
// For properties with special conditions
FDoRepLifetimeParams PushModelParamsWithCondition{ COND_Custom, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableSkeletalMeshComponent, GripLogicScripts, PushModelParamsWithCondition);
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableSkeletalMeshComponent, VRGripInterfaceSettings, PushModelParamsWithCondition);
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableSkeletalMeshComponent, GameplayTags, PushModelParamsWithCondition);
DOREPLIFETIME_CONDITION(UGrippableSkeletalMeshComponent, GripLogicScripts, COND_Custom);
DOREPLIFETIME(UGrippableSkeletalMeshComponent, bReplicateGripScripts);
DOREPLIFETIME(UGrippableSkeletalMeshComponent, bRepGripSettingsAndGameplayTags);
DOREPLIFETIME(UGrippableSkeletalMeshComponent, bReplicateMovement);
DOREPLIFETIME_CONDITION(UGrippableSkeletalMeshComponent, VRGripInterfaceSettings, COND_Custom);
DOREPLIFETIME_CONDITION(UGrippableSkeletalMeshComponent, GameplayTags, COND_Custom);
}
void UGrippableSkeletalMeshComponent::PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker)
@ -400,71 +390,3 @@ FBodyInstance* UGrippableSkeletalMeshComponent::GetBodyInstance(FName BoneName,
return BodyInst;
}
/////////////////////////////////////////////////
//- Push networking getter / setter functions
/////////////////////////////////////////////////
void UGrippableSkeletalMeshComponent::SetReplicateGripScripts(bool bNewReplicateGripScripts)
{
bReplicateGripScripts = bNewReplicateGripScripts;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableSkeletalMeshComponent, bReplicateGripScripts, this);
#endif
}
TArray<TObjectPtr<UVRGripScriptBase>>& UGrippableSkeletalMeshComponent::GetGripLogicScripts()
{
#if WITH_PUSH_MODEL
if (bReplicateGripScripts)
{
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableSkeletalMeshComponent, GripLogicScripts, this);
}
#endif
return GripLogicScripts;
}
void UGrippableSkeletalMeshComponent::SetRepGripSettingsAndGameplayTags(bool bNewRepGripSettingsAndGameplayTags)
{
bRepGripSettingsAndGameplayTags = bNewRepGripSettingsAndGameplayTags;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableSkeletalMeshComponent, bRepGripSettingsAndGameplayTags, this);
#endif
}
void UGrippableSkeletalMeshComponent::SetReplicateMovement(bool bNewReplicateMovement)
{
bReplicateMovement = bNewReplicateMovement;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableSkeletalMeshComponent, bReplicateMovement, this);
#endif
}
FBPInterfaceProperties& UGrippableSkeletalMeshComponent::GetVRGripInterfaceSettings(bool bMarkDirty)
{
#if WITH_PUSH_MODEL
if (bMarkDirty && bRepGripSettingsAndGameplayTags)
{
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableSkeletalMeshComponent, VRGripInterfaceSettings, this);
}
#endif
return VRGripInterfaceSettings;
}
FGameplayTagContainer& UGrippableSkeletalMeshComponent::GetGameplayTags()
{
#if WITH_PUSH_MODEL
if (bRepGripSettingsAndGameplayTags)
{
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableSkeletalMeshComponent, GameplayTags, this);
}
#endif
return GameplayTags;
}
/////////////////////////////////////////////////
//- End Push networking getter / setter functions
/////////////////////////////////////////////////

View file

@ -8,11 +8,6 @@
#include "GripScripts/VRGripScriptBase.h"
#include "Net/UnrealNetwork.h"
#if WITH_PUSH_MODEL
#include "Net/Core/PushModel/PushModel.h"
#endif
//=============================================================================
UGrippableSphereComponent::UGrippableSphereComponent(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
@ -47,19 +42,12 @@ void UGrippableSphereComponent::GetLifetimeReplicatedProps(TArray< class FLifeti
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// For std properties
FDoRepLifetimeParams PushModelParams{ COND_None, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableSphereComponent, bReplicateGripScripts, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableSphereComponent, bRepGripSettingsAndGameplayTags, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableSphereComponent, bReplicateMovement, PushModelParams);
// For properties with special conditions
FDoRepLifetimeParams PushModelParamsWithCondition{ COND_Custom, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableSphereComponent, GripLogicScripts, PushModelParamsWithCondition);
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableSphereComponent, VRGripInterfaceSettings, PushModelParamsWithCondition);
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableSphereComponent, GameplayTags, PushModelParamsWithCondition);
DOREPLIFETIME_CONDITION(UGrippableSphereComponent, GripLogicScripts, COND_Custom);
DOREPLIFETIME(UGrippableSphereComponent, bReplicateGripScripts)
DOREPLIFETIME(UGrippableSphereComponent, bRepGripSettingsAndGameplayTags);
DOREPLIFETIME(UGrippableSphereComponent, bReplicateMovement);
DOREPLIFETIME_CONDITION(UGrippableSphereComponent, VRGripInterfaceSettings, COND_Custom);
DOREPLIFETIME_CONDITION(UGrippableSphereComponent, GameplayTags, COND_Custom);
}
void UGrippableSphereComponent::PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker)
@ -332,72 +320,3 @@ void UGrippableSphereComponent::OnComponentDestroyed(bool bDestroyingHierarchy)
GripLogicScripts.Empty();
}
/////////////////////////////////////////////////
//- Push networking getter / setter functions
/////////////////////////////////////////////////
void UGrippableSphereComponent::SetReplicateGripScripts(bool bNewReplicateGripScripts)
{
bReplicateGripScripts = bNewReplicateGripScripts;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableSphereComponent, bReplicateGripScripts, this);
#endif
}
TArray<TObjectPtr<UVRGripScriptBase>>& UGrippableSphereComponent::GetGripLogicScripts()
{
#if WITH_PUSH_MODEL
if (bReplicateGripScripts)
{
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableSphereComponent, GripLogicScripts, this);
}
#endif
return GripLogicScripts;
}
void UGrippableSphereComponent::SetRepGripSettingsAndGameplayTags(bool bNewRepGripSettingsAndGameplayTags)
{
bRepGripSettingsAndGameplayTags = bNewRepGripSettingsAndGameplayTags;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableSphereComponent, bRepGripSettingsAndGameplayTags, this);
#endif
}
void UGrippableSphereComponent::SetReplicateMovement(bool bNewReplicateMovement)
{
bReplicateMovement = bNewReplicateMovement;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableSphereComponent, bReplicateMovement, this);
#endif
}
FBPInterfaceProperties& UGrippableSphereComponent::GetVRGripInterfaceSettings(bool bMarkDirty)
{
#if WITH_PUSH_MODEL
if (bMarkDirty && bRepGripSettingsAndGameplayTags)
{
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableSphereComponent, VRGripInterfaceSettings, this);
}
#endif
return VRGripInterfaceSettings;
}
FGameplayTagContainer& UGrippableSphereComponent::GetGameplayTags()
{
#if WITH_PUSH_MODEL
if (bRepGripSettingsAndGameplayTags)
{
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableSphereComponent, GameplayTags, this);
}
#endif
return GameplayTags;
}
/////////////////////////////////////////////////
//- End Push networking getter / setter functions
/////////////////////////////////////////////////

View file

@ -110,20 +110,13 @@ void AGrippableStaticMeshActor::GetLifetimeReplicatedProps(TArray< class FLifeti
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// For std properties
FDoRepLifetimeParams PushModelParams{ COND_None, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(AGrippableStaticMeshActor, bReplicateGripScripts, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(AGrippableStaticMeshActor, bRepGripSettingsAndGameplayTags, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(AGrippableStaticMeshActor, bAllowIgnoringAttachOnOwner, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(AGrippableStaticMeshActor, ClientAuthReplicationData, PushModelParams);
// For properties with special conditions
FDoRepLifetimeParams PushModelParamsWithCondition{ COND_Custom, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(AGrippableStaticMeshActor, GripLogicScripts, PushModelParamsWithCondition);
DOREPLIFETIME_WITH_PARAMS_FAST(AGrippableStaticMeshActor, VRGripInterfaceSettings, PushModelParamsWithCondition);
DOREPLIFETIME_WITH_PARAMS_FAST(AGrippableStaticMeshActor, GameplayTags, PushModelParamsWithCondition);
DOREPLIFETIME_CONDITION(AGrippableStaticMeshActor, GripLogicScripts, COND_Custom);
DOREPLIFETIME(AGrippableStaticMeshActor, bReplicateGripScripts);
DOREPLIFETIME(AGrippableStaticMeshActor, bRepGripSettingsAndGameplayTags);
DOREPLIFETIME(AGrippableStaticMeshActor, bAllowIgnoringAttachOnOwner);
DOREPLIFETIME(AGrippableStaticMeshActor, ClientAuthReplicationData);
DOREPLIFETIME_CONDITION(AGrippableStaticMeshActor, VRGripInterfaceSettings, COND_Custom);
DOREPLIFETIME_CONDITION(AGrippableStaticMeshActor, GameplayTags, COND_Custom);
DISABLE_REPLICATED_PRIVATE_PROPERTY(AActor, AttachmentReplication);
@ -896,79 +889,3 @@ void AGrippableStaticMeshActor::GetSubobjectsWithStableNamesForNetworking(TArray
}
}
}
/////////////////////////////////////////////////
//- Push networking getter / setter functions
/////////////////////////////////////////////////
void AGrippableStaticMeshActor::SetReplicateGripScripts(bool bNewReplicateGripScripts)
{
bReplicateGripScripts = bNewReplicateGripScripts;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableStaticMeshActor, bReplicateGripScripts, this);
#endif
}
TArray<TObjectPtr<UVRGripScriptBase>>& AGrippableStaticMeshActor::GetGripLogicScripts()
{
#if WITH_PUSH_MODEL
if (bReplicateGripScripts)
{
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableStaticMeshActor, GripLogicScripts, this);
}
#endif
return GripLogicScripts;
}
void AGrippableStaticMeshActor::SetRepGripSettingsAndGameplayTags(bool bNewRepGripSettingsAndGameplayTags)
{
bRepGripSettingsAndGameplayTags = bNewRepGripSettingsAndGameplayTags;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableStaticMeshActor, bRepGripSettingsAndGameplayTags, this);
#endif
}
void AGrippableStaticMeshActor::SetAllowIgnoringAttachOnOwner(bool bNewAllowIgnoringAttachOnOwner)
{
bAllowIgnoringAttachOnOwner = bNewAllowIgnoringAttachOnOwner;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableStaticMeshActor, bAllowIgnoringAttachOnOwner, this);
#endif
}
FVRClientAuthReplicationData& AGrippableStaticMeshActor::GetClientAuthReplicationData(FVRClientAuthReplicationData& ClientAuthData)
{
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableStaticMeshActor, ClientAuthReplicationData, this);
#endif
return ClientAuthReplicationData;
}
FBPInterfaceProperties& AGrippableStaticMeshActor::GetVRGripInterfaceSettings(bool bMarkDirty)
{
#if WITH_PUSH_MODEL
if (bMarkDirty && bRepGripSettingsAndGameplayTags)
{
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableStaticMeshActor, VRGripInterfaceSettings, this);
}
#endif
return VRGripInterfaceSettings;
}
FGameplayTagContainer& AGrippableStaticMeshActor::GetGameplayTags()
{
#if WITH_PUSH_MODEL
if (bRepGripSettingsAndGameplayTags)
{
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableStaticMeshActor, GameplayTags, this);
}
#endif
return GameplayTags;
}
/////////////////////////////////////////////////
//- End Push networking getter / setter functions
/////////////////////////////////////////////////

View file

@ -7,9 +7,6 @@
#include "VRExpansionFunctionLibrary.h"
#include "GripScripts/VRGripScriptBase.h"
#include "Net/UnrealNetwork.h"
#if WITH_PUSH_MODEL
#include "Net/Core/PushModel/PushModel.h"
#endif
//=============================================================================
UGrippableStaticMeshComponent::UGrippableStaticMeshComponent(const FObjectInitializer& ObjectInitializer)
@ -46,19 +43,12 @@ void UGrippableStaticMeshComponent::GetLifetimeReplicatedProps(TArray< class FLi
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// For std properties
FDoRepLifetimeParams PushModelParams{ COND_None, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableStaticMeshComponent, bReplicateGripScripts, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableStaticMeshComponent, bRepGripSettingsAndGameplayTags, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableStaticMeshComponent, bReplicateMovement, PushModelParams);
// For properties with special conditions
FDoRepLifetimeParams PushModelParamsWithCondition{ COND_Custom, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableStaticMeshComponent, GripLogicScripts, PushModelParamsWithCondition);
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableStaticMeshComponent, VRGripInterfaceSettings, PushModelParamsWithCondition);
DOREPLIFETIME_WITH_PARAMS_FAST(UGrippableStaticMeshComponent, GameplayTags, PushModelParamsWithCondition);
DOREPLIFETIME_CONDITION(UGrippableStaticMeshComponent, GripLogicScripts, COND_Custom);
DOREPLIFETIME(UGrippableStaticMeshComponent, bReplicateGripScripts);
DOREPLIFETIME(UGrippableStaticMeshComponent, bRepGripSettingsAndGameplayTags);
DOREPLIFETIME(UGrippableStaticMeshComponent, bReplicateMovement);
DOREPLIFETIME_CONDITION(UGrippableStaticMeshComponent, VRGripInterfaceSettings, COND_Custom);
DOREPLIFETIME_CONDITION(UGrippableStaticMeshComponent, GameplayTags, COND_Custom);
}
void UGrippableStaticMeshComponent::PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker)
@ -325,71 +315,3 @@ void UGrippableStaticMeshComponent::OnComponentDestroyed(bool bDestroyingHierarc
GripLogicScripts.Empty();
}
/////////////////////////////////////////////////
//- Push networking getter / setter functions
/////////////////////////////////////////////////
void UGrippableStaticMeshComponent::SetReplicateGripScripts(bool bNewReplicateGripScripts)
{
bReplicateGripScripts = bNewReplicateGripScripts;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableStaticMeshComponent, bReplicateGripScripts, this);
#endif
}
TArray<TObjectPtr<UVRGripScriptBase>>& UGrippableStaticMeshComponent::GetGripLogicScripts()
{
#if WITH_PUSH_MODEL
if (bReplicateGripScripts)
{
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableStaticMeshComponent, GripLogicScripts, this);
}
#endif
return GripLogicScripts;
}
void UGrippableStaticMeshComponent::SetRepGripSettingsAndGameplayTags(bool bNewRepGripSettingsAndGameplayTags)
{
bRepGripSettingsAndGameplayTags = bNewRepGripSettingsAndGameplayTags;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableStaticMeshComponent, bRepGripSettingsAndGameplayTags, this);
#endif
}
void UGrippableStaticMeshComponent::SetReplicateMovement(bool bNewReplicateMovement)
{
bReplicateMovement = bNewReplicateMovement;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableStaticMeshComponent, bReplicateMovement, this);
#endif
}
FBPInterfaceProperties& UGrippableStaticMeshComponent::GetVRGripInterfaceSettings(bool bMarkDirty)
{
#if WITH_PUSH_MODEL
if (bMarkDirty && bRepGripSettingsAndGameplayTags)
{
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableStaticMeshComponent, VRGripInterfaceSettings, this);
}
#endif
return VRGripInterfaceSettings;
}
FGameplayTagContainer& UGrippableStaticMeshComponent::GetGameplayTags()
{
#if WITH_PUSH_MODEL
if (bRepGripSettingsAndGameplayTags)
{
MARK_PROPERTY_DIRTY_FROM_NAME(UGrippableStaticMeshComponent, GameplayTags, this);
}
#endif
return GameplayTags;
}
/////////////////////////////////////////////////
//- End Push networking getter / setter functions
/////////////////////////////////////////////////

View file

@ -3,16 +3,11 @@
#include "Grippables/HandSocketComponent.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(HandSocketComponent)
#include "CoreMinimal.h"
#include "UObject/UObjectIterator.h"
#include "Engine/CollisionProfile.h"
#include "BoneContainer.h"
#include "Animation/AnimSequence.h"
#include "Animation/AnimInstanceProxy.h"
#include "Animation/PoseSnapshot.h"
#include "Animation/AnimData/AnimDataModel.h"
#include "Engine/SkinnedAssetCommon.h"
#include "Engine/SkinnedAsset.h"
//#include "VRExpansionFunctionLibrary.h"
#include "Components/SkeletalMeshComponent.h"
#include "Components/PoseableMeshComponent.h"
@ -22,10 +17,6 @@
#include "Net/UnrealNetwork.h"
#include "Serialization/CustomVersion.h"
#if WITH_PUSH_MODEL
#include "Net/Core/PushModel/PushModel.h"
#endif
DEFINE_LOG_CATEGORY(LogVRHandSocketComponent);
const FGuid FVRHandSocketCustomVersion::GUID(0x5A018B7F, 0x48A7AFDE, 0xAFBEB580, 0xAD575412);
@ -886,16 +877,9 @@ void UHandSocketComponent::GetLifetimeReplicatedProps(TArray< class FLifetimePro
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// For std properties
FDoRepLifetimeParams PushModelParams{ COND_None, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UHandSocketComponent, bRepGameplayTags, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UHandSocketComponent, bReplicateMovement, PushModelParams);
// For properties with special conditions
FDoRepLifetimeParams PushModelParamsWithCondition{ COND_Custom, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UHandSocketComponent, GameplayTags, PushModelParamsWithCondition);
DOREPLIFETIME(UHandSocketComponent, bRepGameplayTags);
DOREPLIFETIME(UHandSocketComponent, bReplicateMovement);
DOREPLIFETIME_CONDITION(UHandSocketComponent, GameplayTags, COND_Custom);
}
void UHandSocketComponent::PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker)
@ -980,46 +964,3 @@ UHandSocketComponent* UHandSocketComponent::GetHandSocketComponentFromObject(UOb
return nullptr;
}
/////////////////////////////////////////////////
//- Push networking getter / setter functions
/////////////////////////////////////////////////
void UHandSocketComponent::SetRepGameplayTags(bool bNewRepGameplayTags)
{
bRepGameplayTags = bNewRepGameplayTags;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UHandSocketComponent, bRepGameplayTags, this);
#endif
}
void UHandSocketComponent::SetReplicateMovement(bool bNewReplicateMovement)
{
bReplicateMovement = bNewReplicateMovement;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UHandSocketComponent, bReplicateMovement, this);
#endif
}
FGameplayTagContainer& UHandSocketComponent::GetGameplayTags()
{
#if WITH_PUSH_MODEL
if (bRepGameplayTags)
{
MARK_PROPERTY_DIRTY_FROM_NAME(UHandSocketComponent, GameplayTags, this);
}
#endif
return GameplayTags;
}
/////////////////////////////////////////////////
//- End Push networking getter / setter functions
/////////////////////////////////////////////////
void UHandSocketAnimInstance::NativeInitializeAnimation()
{
Super::NativeInitializeAnimation();
OwningSocket = Cast<UHandSocketComponent>(GetOwningComponent()->GetAttachParent());
}

View file

@ -9,10 +9,6 @@
#include "GameFramework/Character.h"
#include "GameFramework/PlayerController.h"
#if WITH_PUSH_MODEL
#include "Net/Core/PushModel/PushModel.h"
#endif
//=============================================================================
UVRButtonComponent::UVRButtonComponent(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
@ -52,17 +48,10 @@ void UVRButtonComponent::GetLifetimeReplicatedProps(TArray< class FLifetimePrope
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// For std properties
FDoRepLifetimeParams PushModelParams{ COND_None, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UVRButtonComponent, InitialRelativeTransform, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UVRButtonComponent, bReplicateMovement, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UVRButtonComponent, StateChangeAuthorityType, PushModelParams);
// For properties with special conditions
FDoRepLifetimeParams PushModelParamsWithCondition{ COND_InitialOnly, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UVRButtonComponent, bButtonState, PushModelParamsWithCondition);
DOREPLIFETIME(UVRButtonComponent, InitialRelativeTransform);
DOREPLIFETIME(UVRButtonComponent, bReplicateMovement);
DOREPLIFETIME(UVRButtonComponent, StateChangeAuthorityType);
DOREPLIFETIME_CONDITION(UVRButtonComponent, bButtonState, COND_InitialOnly);
}
void UVRButtonComponent::PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker)
@ -434,27 +423,3 @@ FVector UVRButtonComponent::SetAxisValue(float SetValue)
return vec;
}
void UVRButtonComponent::SetReplicateMovement(bool bNewReplicateMovement)
{
bReplicateMovement = bNewReplicateMovement;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UVRButtonComponent, bReplicateMovement, this);
#endif
}
void UVRButtonComponent::SetStateChangeAuthorityType(EVRStateChangeAuthorityType NewStateChangeAuthorityType)
{
StateChangeAuthorityType = NewStateChangeAuthorityType;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UVRButtonComponent, StateChangeAuthorityType, this);
#endif
}
void UVRButtonComponent::SetButtonState(bool bNewButtonState)
{
bButtonState = bNewButtonState;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UVRButtonComponent, bButtonState, this);
#endif
}

View file

@ -7,10 +7,6 @@
#include "GripMotionControllerComponent.h"
#include "Net/UnrealNetwork.h"
#if WITH_PUSH_MODEL
#include "Net/Core/PushModel/PushModel.h"
#endif
//=============================================================================
UVRDialComponent::UVRDialComponent(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
@ -67,19 +63,12 @@ void UVRDialComponent::GetLifetimeReplicatedProps(TArray< class FLifetimePropert
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// For std properties
FDoRepLifetimeParams PushModelParams{ COND_None, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UVRDialComponent, InitialRelativeTransform, PushModelParams);
DOREPLIFETIME(UVRDialComponent, InitialRelativeTransform);
//DOREPLIFETIME_CONDITION(UVRDialComponent, bIsLerping, COND_InitialOnly);
DOREPLIFETIME_WITH_PARAMS_FAST(UVRDialComponent, bRepGameplayTags, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UVRDialComponent, bReplicateMovement, PushModelParams);
// For properties with special conditions
FDoRepLifetimeParams PushModelParamsWithCondition{ COND_Custom, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UVRDialComponent, GameplayTags, PushModelParamsWithCondition);
DOREPLIFETIME(UVRDialComponent, bRepGameplayTags);
DOREPLIFETIME(UVRDialComponent, bReplicateMovement);
DOREPLIFETIME_CONDITION(UVRDialComponent, GameplayTags, COND_Custom);
}
void UVRDialComponent::PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker)
@ -619,11 +608,6 @@ void UVRDialComponent::ResetInitialDialLocation()
{
// Get our initial relative transform to our parent (or not if un-parented).
InitialRelativeTransform = this->GetRelativeTransform();
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UVRDialComponent, InitialRelativeTransform, this);
#endif
CurRotBackEnd = 0.0f;
CalculateDialProgress();
}
@ -635,32 +619,3 @@ void UVRDialComponent::CalculateDialProgress()
CurRotBackEnd = LastGripRot;
AddDialAngle(0.0f, false, true);
}
void UVRDialComponent::SetRepGameplayTags(bool bNewRepGameplayTags)
{
bRepGameplayTags = bNewRepGameplayTags;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UVRDialComponent, bRepGameplayTags, this);
#endif
}
void UVRDialComponent::SetReplicateMovement(bool bNewReplicateMovement)
{
bReplicateMovement = bNewReplicateMovement;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UVRDialComponent, bReplicateMovement, this);
#endif
}
FGameplayTagContainer& UVRDialComponent::GetGameplayTags()
{
#if WITH_PUSH_MODEL
if (bRepGameplayTags)
{
MARK_PROPERTY_DIRTY_FROM_NAME(UVRDialComponent, GameplayTags, this);
}
#endif
return GameplayTags;
}

View file

@ -7,10 +7,6 @@
#include "VRExpansionFunctionLibrary.h"
#include "Net/UnrealNetwork.h"
#if WITH_PUSH_MODEL
#include "Net/Core/PushModel/PushModel.h"
#endif
//=============================================================================
UVRLeverComponent::UVRLeverComponent(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
@ -89,19 +85,12 @@ void UVRLeverComponent::GetLifetimeReplicatedProps(TArray< class FLifetimeProper
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// For std properties
FDoRepLifetimeParams PushModelParams{ COND_None, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME(UVRLeverComponent, InitialRelativeTransform);
//DOREPLIFETIME_CONDITION(UVRLeverComponent, bIsLerping, COND_InitialOnly);
DOREPLIFETIME_WITH_PARAMS_FAST(UVRLeverComponent, InitialRelativeTransform, PushModelParams);
//DOREPLIFETIME_CONDITION(UVRDialComponent, bIsLerping, COND_InitialOnly);
DOREPLIFETIME_WITH_PARAMS_FAST(UVRLeverComponent, bRepGameplayTags, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UVRLeverComponent, bReplicateMovement, PushModelParams);
// For properties with special conditions
FDoRepLifetimeParams PushModelParamsWithCondition{ COND_Custom, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UVRLeverComponent, GameplayTags, PushModelParamsWithCondition);
DOREPLIFETIME(UVRLeverComponent, bRepGameplayTags);
DOREPLIFETIME(UVRLeverComponent, bReplicateMovement);
DOREPLIFETIME_CONDITION(UVRLeverComponent, GameplayTags, COND_Custom);
}
void UVRLeverComponent::PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker)
@ -666,11 +655,6 @@ void UVRLeverComponent::ResetInitialLeverLocation(bool bAllowThrowingEvents)
{
// Get our initial relative transform to our parent (or not if un-parented).
InitialRelativeTransform = this->GetRelativeTransform();
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UVRLeverComponent, InitialRelativeTransform, this);
#endif
CalculateCurrentAngle(InitialRelativeTransform);
ProccessCurrentState(bIsLerping, bAllowThrowingEvents, bAllowThrowingEvents);
}
@ -833,31 +817,3 @@ float UVRLeverComponent::CalcAngle(EVRInteractibleLeverAxis AxisToCalc, FVector
bIsInFirstTick = false;
return ReturnAxis;
}
void UVRLeverComponent::SetRepGameplayTags(bool bNewRepGameplayTags)
{
bRepGameplayTags = bNewRepGameplayTags;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UVRLeverComponent, bRepGameplayTags, this);
#endif
}
void UVRLeverComponent::SetReplicateMovement(bool bNewReplicateMovement)
{
bReplicateMovement = bNewReplicateMovement;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UVRLeverComponent, bReplicateMovement, this);
#endif
}
FGameplayTagContainer& UVRLeverComponent::GetGameplayTags()
{
#if WITH_PUSH_MODEL
if (bRepGameplayTags)
{
MARK_PROPERTY_DIRTY_FROM_NAME(UVRLeverComponent, GameplayTags, this);
}
#endif
return GameplayTags;
}

View file

@ -9,10 +9,6 @@
//#include "PhysicsEngine/ConstraintInstance.h"
#include "Net/UnrealNetwork.h"
#if WITH_PUSH_MODEL
#include "Net/Core/PushModel/PushModel.h"
#endif
//=============================================================================
UVRMountComponent::UVRMountComponent(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
@ -62,16 +58,9 @@ void UVRMountComponent::GetLifetimeReplicatedProps(TArray< class FLifetimeProper
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// For std properties
FDoRepLifetimeParams PushModelParams{ COND_None, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UVRMountComponent, bRepGameplayTags, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UVRMountComponent, bReplicateMovement, PushModelParams);
// For properties with special conditions
FDoRepLifetimeParams PushModelParamsWithCondition{ COND_Custom, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UVRMountComponent, GameplayTags, PushModelParamsWithCondition);
DOREPLIFETIME(UVRMountComponent, bRepGameplayTags);
DOREPLIFETIME(UVRMountComponent, bReplicateMovement);
DOREPLIFETIME_CONDITION(UVRMountComponent, GameplayTags, COND_Custom);
}
void UVRMountComponent::PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker)
@ -588,42 +577,8 @@ void UVRMountComponent::SetHeld_Implementation(UGripMotionControllerComponent *
return FBPInteractionSettings();
}*/
void UVRMountComponent::ResetInitialMountLocation()
{
// Get our initial relative transform to our parent (or not if un-parented).
InitialRelativeTransform = this->GetRelativeTransform();
}
bool UVRMountComponent::GetGripScripts_Implementation(TArray<UVRGripScriptBase*> & ArrayReference)
{
return false;
}
void UVRMountComponent::SetRepGameplayTags(bool bNewRepGameplayTags)
{
bRepGameplayTags = bNewRepGameplayTags;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UVRMountComponent, bRepGameplayTags, this);
#endif
}
void UVRMountComponent::SetReplicateMovement(bool bNewReplicateMovement)
{
bReplicateMovement = bNewReplicateMovement;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UVRMountComponent, bReplicateMovement, this);
#endif
}
FGameplayTagContainer& UVRMountComponent::GetGameplayTags()
{
#if WITH_PUSH_MODEL
if (bRepGameplayTags)
{
MARK_PROPERTY_DIRTY_FROM_NAME(UVRMountComponent, GameplayTags, this);
}
#endif
return GameplayTags;
}

View file

@ -8,10 +8,6 @@
#include "GripMotionControllerComponent.h"
#include "Net/UnrealNetwork.h"
#if WITH_PUSH_MODEL
#include "Net/Core/PushModel/PushModel.h"
#endif
//=============================================================================
UVRSliderComponent::UVRSliderComponent(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
@ -88,20 +84,13 @@ void UVRSliderComponent::GetLifetimeReplicatedProps(TArray< class FLifetimePrope
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// For std properties
FDoRepLifetimeParams PushModelParams{ COND_None, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME(UVRSliderComponent, InitialRelativeTransform);
DOREPLIFETIME(UVRSliderComponent, SplineComponentToFollow);
//DOREPLIFETIME_CONDITION(UVRSliderComponent, bIsLerping, COND_InitialOnly);
DOREPLIFETIME_WITH_PARAMS_FAST(UVRSliderComponent, InitialRelativeTransform, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UVRSliderComponent, SplineComponentToFollow, PushModelParams);
//DOREPLIFETIME_CONDITION(UVRDialComponent, bIsLerping, COND_InitialOnly);
DOREPLIFETIME_WITH_PARAMS_FAST(UVRSliderComponent, bRepGameplayTags, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(UVRSliderComponent, bReplicateMovement, PushModelParams);
// For properties with special conditions
FDoRepLifetimeParams PushModelParamsWithCondition{ COND_Custom, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UVRSliderComponent, GameplayTags, PushModelParamsWithCondition);
DOREPLIFETIME(UVRSliderComponent, bRepGameplayTags);
DOREPLIFETIME(UVRSliderComponent, bReplicateMovement);
DOREPLIFETIME_CONDITION(UVRSliderComponent, GameplayTags, COND_Custom);
}
void UVRSliderComponent::PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker)
@ -908,10 +897,6 @@ void UVRSliderComponent::SetSplineComponentToFollow(USplineComponent * SplineToF
{
SplineComponentToFollow = SplineToFollow;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UVRSliderComponent, SplineComponentToFollow, this);
#endif
if (SplineToFollow != nullptr)
ResetToParentSplineLocation();
else
@ -922,11 +907,6 @@ void UVRSliderComponent::ResetInitialSliderLocation()
{
// Get our initial relative transform to our parent (or not if un-parented).
InitialRelativeTransform = this->GetRelativeTransform();
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UVRSliderComponent, InitialRelativeTransform, this);
#endif
ResetToParentSplineLocation();
if (SplineComponentToFollow == nullptr)
@ -1011,31 +991,3 @@ float UVRSliderComponent::CalculateSliderProgress()
return CurrentSliderProgress;
}
void UVRSliderComponent::SetRepGameplayTags(bool bNewRepGameplayTags)
{
bRepGameplayTags = bNewRepGameplayTags;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UVRSliderComponent, bRepGameplayTags, this);
#endif
}
void UVRSliderComponent::SetReplicateMovement(bool bNewReplicateMovement)
{
bReplicateMovement = bNewReplicateMovement;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UVRSliderComponent, bReplicateMovement, this);
#endif
}
FGameplayTagContainer& UVRSliderComponent::GetGameplayTags()
{
#if WITH_PUSH_MODEL
if (bRepGameplayTags)
{
MARK_PROPERTY_DIRTY_FROM_NAME(UVRSliderComponent, GameplayTags, this);
}
#endif
return GameplayTags;
}

View file

@ -4,7 +4,6 @@
#include UE_INLINE_GENERATED_CPP_BY_NAME(CollisionIgnoreSubsystem)
#include "Components/SkeletalMeshComponent.h"
#include "Engine/World.h"
#include "Runtime/Engine/Classes/Kismet/GameplayStatics.h"
#include "VRGlobalSettings.h"
@ -93,16 +92,6 @@ void UCollisionIgnoreSubsystem::ConstructInput()
}
}
void UCollisionIgnoreSubsystem::Deinitialize()
{
Super::Deinitialize();
if (UpdateHandle.IsValid())
{
GetWorld()->GetTimerManager().ClearTimer(UpdateHandle);
}
}
void UCollisionIgnoreSubsystem::UpdateTimer(bool bChangesWereMade)
{

View file

@ -30,10 +30,7 @@ void UNoRepSphereComponent::GetLifetimeReplicatedProps(TArray< class FLifetimePr
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// For std properties
FDoRepLifetimeParams PushModelParams{ COND_None, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UNoRepSphereComponent, bReplicateMovement, PushModelParams);
DOREPLIFETIME(UNoRepSphereComponent, bReplicateMovement);
RESET_REPLIFETIME_CONDITION_PRIVATE_PROPERTY(USceneComponent, AttachParent, COND_InitialOnly);
RESET_REPLIFETIME_CONDITION_PRIVATE_PROPERTY(USceneComponent, AttachSocketName, COND_InitialOnly);
@ -44,14 +41,6 @@ void UNoRepSphereComponent::GetLifetimeReplicatedProps(TArray< class FLifetimePr
//DISABLE_REPLICATED_PRIVATE_PROPERTY(AActor, AttachmentReplication);
}
void UNoRepSphereComponent::SetReplicateMovement(bool bNewReplicateMovement)
{
bReplicateMovement = bNewReplicateMovement;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UNoRepSphereComponent, bReplicateMovement, this);
#endif
}
void UNoRepSphereComponent::PreReplication(IRepChangedPropertyTracker& ChangedPropertyTracker)
{
Super::PreReplication(ChangedPropertyTracker);
@ -106,15 +95,6 @@ void UInversePhysicsSkeletalMeshComponent::PreReplication(IRepChangedPropertyTra
DOREPLIFETIME_ACTIVE_OVERRIDE_FAST(USceneComponent, RelativeScale3D, bReplicateMovement);
}
void UInversePhysicsSkeletalMeshComponent::SetReplicateMovement(bool bNewReplicateMovement)
{
bReplicateMovement = bNewReplicateMovement;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UInversePhysicsSkeletalMeshComponent, bReplicateMovement, this);
#endif
}
void UInversePhysicsSkeletalMeshComponent::EndPhysicsTickComponentVR(FSkeletalMeshComponentEndPhysicsTickFunctionVR& ThisTickFunction)
{
//IMPORTANT!
@ -652,10 +632,7 @@ void UInversePhysicsSkeletalMeshComponent::GetLifetimeReplicatedProps(TArray< cl
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// For std properties
FDoRepLifetimeParams PushModelParams{ COND_None, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UInversePhysicsSkeletalMeshComponent, bReplicateMovement, PushModelParams);
DOREPLIFETIME(UInversePhysicsSkeletalMeshComponent, bReplicateMovement);
}
AOptionalRepGrippableSkeletalMeshActor::AOptionalRepGrippableSkeletalMeshActor(const FObjectInitializer& ObjectInitializer) :
@ -669,11 +646,8 @@ void AOptionalRepGrippableSkeletalMeshActor::GetLifetimeReplicatedProps(TArray<
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// For properties with special conditions
FDoRepLifetimeParams PushModelParamsWithCondition{ COND_InitialOnly, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(AOptionalRepGrippableSkeletalMeshActor, bIgnoreAttachmentReplication, PushModelParamsWithCondition);
DOREPLIFETIME_WITH_PARAMS_FAST(AOptionalRepGrippableSkeletalMeshActor, bIgnorePhysicsReplication, PushModelParamsWithCondition);
DOREPLIFETIME(AOptionalRepGrippableSkeletalMeshActor, bIgnoreAttachmentReplication);
DOREPLIFETIME(AOptionalRepGrippableSkeletalMeshActor, bIgnorePhysicsReplication);
if (bIgnoreAttachmentReplication)
{

View file

@ -3,11 +3,8 @@
#include "Misc/VRAIPerceptionOverrides.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(VRAIPerceptionOverrides)
#include "CoreMinimal.h"
#include "Engine/Engine.h"
#include "Engine/World.h"
//#include "EngineDefines.h"
//#include "EngineGlobals.h"
#include "EngineDefines.h"
#include "EngineGlobals.h"
#include "CollisionQueryParams.h"
//#include "Engine/Engine.h"
#include "AISystem.h"
@ -48,12 +45,12 @@ DECLARE_CYCLE_STAT(TEXT("Perception Sense: Sight, Process pending result"), STAT
constexpr int32 DefaultMaxTracesPerTick = 6;
constexpr int32 DefaultMaxAsyncTracesPerTick = 10;
constexpr int32 DefaultMinQueriesPerTimeSliceCheck = 40;
constexpr float DefaultPendingQueriesBudgetReductionRatio = 0.5f;
constexpr bool bDefaultUseAsynchronousTraceForDefaultSightQueries = false;
constexpr float DefaultStimulusStrength = 1.f;
static const int32 DefaultMaxTracesPerTick = 6;
static const int32 DefaultMaxAsyncTracesPerTick = 10;
static const int32 DefaultMinQueriesPerTimeSliceCheck = 40;
static const float DefaultPendingQueriesBudgetReductionRatio = 0.5f;
static const bool bDefaultUseAsynchronousTraceForDefaultSightQueries = false;
static const float DefaultStimulusStrength = 1.f;
enum class EForEachResult : uint8
{
@ -114,7 +111,7 @@ FORCEINLINE_DEBUGGABLE bool CheckIsTargetInSightPie(const FPerceptionListener& L
const FAISightTargetVR::FTargetId FAISightTargetVR::InvalidTargetId = FAISystem::InvalidUnsignedID;
FAISightTargetVR::FAISightTargetVR(AActor* InTarget, FGenericTeamId InTeamId)
: Target(InTarget), SightTargetInterface(nullptr), TeamId(InTeamId)
: Target(InTarget), SightTargetInterface(NULL), TeamId(InTeamId)
{
if (InTarget)
{
@ -142,10 +139,8 @@ UAISense_Sight_VR::FDigestedSightProperties::FDigestedSightProperties(const UAIS
}
UAISense_Sight_VR::FDigestedSightProperties::FDigestedSightProperties()
: PeripheralVisionAngleCos(0.f), SightRadiusSq(-1.f), AutoSuccessRangeSqFromLastSeenLocation(FAISystem::InvalidRange), LoseSightRadiusSq(-1.f), PointOfViewBackwardOffset(0.0f), NearClippingRadiusSq(0.0f)
{
AffiliationFlags = FAISenseAffiliationFilter::DetectAllFlags();
}
: PeripheralVisionAngleCos(0.f), SightRadiusSq(-1.f), AutoSuccessRangeSqFromLastSeenLocation(FAISystem::InvalidRange), LoseSightRadiusSq(-1.f), PointOfViewBackwardOffset(0.0f), NearClippingRadiusSq(0.0f), AffiliationFlags(-1)
{}
//----------------------------------------------------------------------//
@ -343,7 +338,7 @@ float UAISense_Sight_VR::Update()
#if AISENSE_SIGHT_TIMESLICING_DEBUG
UE::AISense_SightVR::FTimingSlicingInfo SlicingInfo;
#endif // AISENSE_SIGHT_TIMESLICING_DEBUG
constexpr int32 InitialInvalidItemsSize = 16;
static const int32 InitialInvalidItemsSize = 16;
enum class EOperationType : uint8
{
Remove,
@ -493,7 +488,7 @@ float UAISense_Sight_VR::Update()
});
// Do all the removes first and save the out of range swaps because we will insert them at the right location to prevent sorting
TArray<FAISightQueryVR> SightQueriesOutOfRangeToInsert;
for (const FQueryOperation& Operation : QueryOperations)
for (FQueryOperation& Operation : QueryOperations)
{
switch (Operation.OpType)
{
@ -525,12 +520,12 @@ float UAISense_Sight_VR::Update()
if (Operation.bInRange)
{
// In range queries are always sorted at the beginning of the update
SightQueriesInRange.RemoveAtSwap(Operation.Index, 1, EAllowShrinking::No);
SightQueriesInRange.RemoveAtSwap(Operation.Index, 1, /*bAllowShrinking*/false);
}
else
{
// Preserve the list ordered
SightQueriesOutOfRange.RemoveAt(Operation.Index, 1, EAllowShrinking::No);
SightQueriesOutOfRange.RemoveAt(Operation.Index, 1, /*bAllowShrinking*/false);
if (Operation.Index < NextOutOfRangeIndex)
{
NextOutOfRangeIndex--;
@ -552,7 +547,7 @@ float UAISense_Sight_VR::Update()
for (const auto& TargetId : InvalidTargets)
{
// remove affected queries
RemoveAllQueriesToTarget_Internal(TargetId);
RemoveAllQueriesToTarget(TargetId);
// remove target itself
ObservedTargets.Remove(TargetId);
}
@ -756,7 +751,7 @@ void UAISense_Sight_VR::OnPendingTraceQueryProcessed(const FTraceHandle& TraceHa
void UAISense_Sight_VR::OnPendingQueryProcessed(const int32 SightQueryIndex, const bool bIsVisible, const float StimulusStrength, const FVector& SeenLocation, const TOptional<int32>& UserData, const TOptional<AActor*> InTargetActor)
{
FAISightQueryVR SightQuery = SightQueriesPending[SightQueryIndex];
SightQueriesPending.RemoveAtSwap(SightQueryIndex, 1, EAllowShrinking::No);
SightQueriesPending.RemoveAtSwap(SightQueryIndex, 1, false);
AIPerception::FListenerMap& ListenersMap = *GetListeners();
FPerceptionListener* Listener = ListenersMap.Find(SightQuery.ObserverId);
@ -860,7 +855,7 @@ void UAISense_Sight_VR::UnregisterSource(AActor& SourceActor)
Listener.RegisterStimulus(TargetActor, FAIStimulus(*this, 0.f, SightQuery->LastSeenLocation, Listener.CachedLocation, FAIStimulus::SensingFailed));
}
SightQueries.RemoveAtSwap(QueryIndex, 1, EAllowShrinking::No);
SightQueries.RemoveAtSwap(QueryIndex, 1, /*bAllowShrinking=*/false);
return EReverseForEachResult::Modified;
}
@ -1020,7 +1015,7 @@ void UAISense_Sight_VR::OnListenerUpdateImpl(const FPerceptionListener& UpdatedL
// see if this listener is a Target as well
const FAISightTargetVR::FTargetId AsTargetId = UpdatedListener.GetBodyActorUniqueID();
FAISightTargetVR* AsTarget = ObservedTargets.Find(AsTargetId);
if (AsTarget != nullptr)
if (AsTarget != NULL)
{
if (AsTarget->Target.IsValid())
{
@ -1131,11 +1126,13 @@ void UAISense_Sight_VR::RemoveAllQueriesByListener(const FPerceptionListener& Li
{
OnRemoveFunc(SightQuery);
}
SightQueries.RemoveAtSwap(QueryIndex, 1, EAllowShrinking::No);
SightQueries.RemoveAtSwap(QueryIndex, 1, /*bAllowShrinking=*/false);
return EReverseForEachResult::Modified;
}
return EReverseForEachResult::UnTouched;
};
ReverseForEach(SightQueriesInRange, RemoveQuery);
@ -1151,12 +1148,6 @@ void UAISense_Sight_VR::RemoveAllQueriesToTarget(const FAISightTargetVR::FTarget
{
SCOPE_CYCLE_COUNTER(STAT_AI_Sense_Sight_RemoveToTarget);
UE_MT_SCOPED_WRITE_ACCESS(QueriesListAccessDetector);
RemoveAllQueriesToTarget_Internal(TargetId, OnRemoveFunc);
}
void UAISense_Sight_VR::RemoveAllQueriesToTarget_Internal(const FAISightTargetVR::FTargetId& TargetId, const TFunction<void(const FAISightQueryVR&)>& OnRemoveFunc/*= nullptr */)
{
SCOPE_CYCLE_COUNTER(STAT_AI_Sense_Sight_RemoveToTarget);
auto RemoveQuery = [&TargetId, &OnRemoveFunc](TArray<FAISightQueryVR>& SightQueries, const int32 QueryIndex)->EReverseForEachResult
{
@ -1168,7 +1159,7 @@ void UAISense_Sight_VR::RemoveAllQueriesToTarget_Internal(const FAISightTargetVR
{
OnRemoveFunc(SightQuery);
}
SightQueries.RemoveAtSwap(QueryIndex, 1, EAllowShrinking::No);
SightQueries.RemoveAtSwap(QueryIndex, 1, /*bAllowShrinking=*/false);
return EReverseForEachResult::Modified;
}

View file

@ -8,11 +8,9 @@
#include "ReferenceSkeleton.h"
#include "DrawDebugHelpers.h"
#if UE_ENABLE_DEBUG_DRAWING
#if ENABLE_DRAW_DEBUG
#include "Chaos/ImplicitObject.h"
#include "Chaos/TriangleMeshImplicitObject.h"
#include "Chaos/ShapeInstance.h"
#include "Chaos/DebugDrawQueue.h"
#endif
#include "Physics/PhysicsInterfaceCore.h"
@ -233,8 +231,8 @@ void UVREPhysicalAnimationComponent::UpdateWeldedBoneDriver(float DeltaTime)
if (FPhysicsInterface::IsValid(ActorHandle) /*&& FPhysicsInterface::IsRigidBody(ActorHandle)*/)
{
#if UE_ENABLE_DEBUG_DRAWING
if (false)//bDebugDrawCollision)
#if ENABLE_DRAW_DEBUG
if (bDebugDrawCollision)
{
Chaos::FDebugDrawQueue::GetInstance().SetConsumerActive(this, true); // Need to deactivate this later as well
Chaos::FDebugDrawQueue::GetInstance().SetMaxCost(20000);
@ -253,8 +251,8 @@ void UVREPhysicalAnimationComponent::UpdateWeldedBoneDriver(float DeltaTime)
FTransform GlobalPoseInv = GlobalPose.Inverse();
#if UE_ENABLE_DEBUG_DRAWING
if (false)//bDebugDrawCollision)
#if ENABLE_DRAW_DEBUG
if (bDebugDrawCollision)
{
Chaos::FDebugDrawQueue::GetInstance().SetRegionOfInterest(GlobalPose.GetLocation(), 100.0f);
}
@ -307,33 +305,33 @@ void UVREPhysicalAnimationComponent::UpdateWeldedBoneDriver(float DeltaTime)
}
}
#if UE_ENABLE_DEBUG_DRAWING
if (false)//bDebugDrawCollision)
#if ENABLE_DRAW_DEBUG
if (bDebugDrawCollision)
{
/*const Chaos::FImplicitObject& ShapeImplicit = Shape.GetGeometry();
Chaos::EImplicitObjectType Type = ShapeImplicit.GetType();
const Chaos::FImplicitObject* ShapeImplicit = Shape.Shape->GetGeometry().Get();
Chaos::EImplicitObjectType Type = ShapeImplicit->GetType();
FTransform shapeTransform = FPhysicsInterface::GetLocalTransform(Shape);
FTransform FinalTransform = shapeTransform * GlobalPose;
Chaos::FRigidTransform3 RigTransform(FinalTransform);
Chaos::DebugDraw::DrawShape(RigTransform, &ShapeImplicit, Shape.Shape, FColor::White);*/
Chaos::DebugDraw::DrawShape(RigTransform, ShapeImplicit, Chaos::FShapeOrShapesArray(), FColor::White);
}
#endif
}
});
#if UE_ENABLE_DEBUG_DRAWING
if (false)//bDebugDrawCollision)
#if ENABLE_DRAW_DEBUG
if (bDebugDrawCollision)
{
// Get the latest commands
/*TArray<Chaos::FLatentDrawCommand> DrawCommands;
TArray<Chaos::FLatentDrawCommand> DrawCommands;
Chaos::FDebugDrawQueue::GetInstance().ExtractAllElements(DrawCommands);
if (DrawCommands.Num())
{
DebugDrawMesh(DrawCommands);
}
Chaos::FDebugDrawQueue::GetInstance().SetConsumerActive(this, false); // Need to deactivate this later as well
Chaos::FDebugDrawQueue::GetInstance().SetEnabled(false);*/
Chaos::FDebugDrawQueue::GetInstance().SetEnabled(false);
}
#endif
}
@ -343,8 +341,7 @@ void UVREPhysicalAnimationComponent::UpdateWeldedBoneDriver(float DeltaTime)
}
}
#if UE_ENABLE_DEBUG_DRAWING
/*
#if ENABLE_DRAW_DEBUG
void UVREPhysicalAnimationComponent::DebugDrawMesh(const TArray<Chaos::FLatentDrawCommand>& DrawCommands)
{
UWorld* World = this->GetWorld();
@ -385,5 +382,5 @@ void UVREPhysicalAnimationComponent::DebugDrawMesh(const TArray<Chaos::FLatentDr
break;
}
}
}*/
}
#endif

View file

@ -4,7 +4,7 @@
#include UE_INLINE_GENERATED_CPP_BY_NAME(VRFullScreenUserWidget)
//#include "Components/PostProcessComponent.h"
#include "Engine/Engine.h"
//#include "Engine/Engine.h"
#include "Engine/GameInstance.h"
#include "Engine/GameViewportClient.h"
#include "Engine/TextureRenderTarget2D.h"

View file

@ -3,9 +3,6 @@
#include "Misc/VRLogComponent.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(VRLogComponent)
#include "Engine/Engine.h"
#include "GenericPlatform\GenericPlatformInputDeviceMapper.h"
#include "Engine\GameViewportClient.h"
#include "GlobalRenderResources.h"
//#include "Engine/Engine.h"

View file

@ -3,8 +3,6 @@
#include "Misc/VRPlayerStart.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(VRPlayerStart)
#include "CoreMinimal.h"
#include "Engine/World.h"
#include "Components/CapsuleComponent.h"
#include "Components/BillboardComponent.h"

View file

@ -3,17 +3,12 @@
#include "Misc/VRRenderTargetManager.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(VRRenderTargetManager)
#include "Engine/World.h"
#include "GlobalRenderResources.h"
#include "Components/ActorComponent.h"
#include "Kismet/GameplayStatics.h"
#include "GameFramework\Pawn.h"
#include "GameFramework/PlayerState.h"
#include "GameFramework/PlayerController.h"
#include "Engine/TextureRenderTarget2D.h"
#include "Engine/Texture2D.h"
#include "TextureResource.h"
#include "PixelFormat.h"
#include "CanvasTypes.h"
#include "Kismet/KismetMathLibrary.h"
#include "Kismet/KismetRenderingLibrary.h"
@ -284,7 +279,7 @@ void UVRRenderTargetManager::DrawOperations()
UWorld* World = GetWorld();
if (!World || !World->GetBegunPlay())
if (!World || !World->bBegunPlay)
return;
// Reference to the Render Target resource
@ -490,24 +485,14 @@ void ARenderTargetReplicationProxy::SendNextDataBlob()
}
}
void ARenderTargetReplicationProxy::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
if (SendTimer_Handle.IsValid())
GetWorld()->GetTimerManager().ClearTimer(SendTimer_Handle);
Super::EndPlay(EndPlayReason);
}
//=============================================================================
void ARenderTargetReplicationProxy::GetLifetimeReplicatedProps(TArray< class FLifetimeProperty >& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// For properties with special conditions
FDoRepLifetimeParams PushModelParamsWithCondition{ COND_InitialOnly, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(ARenderTargetReplicationProxy, OwningManager, PushModelParamsWithCondition);
DOREPLIFETIME_WITH_PARAMS_FAST(ARenderTargetReplicationProxy, OwnersID, PushModelParamsWithCondition);
DOREPLIFETIME(ARenderTargetReplicationProxy, OwningManager);
DOREPLIFETIME(ARenderTargetReplicationProxy, OwnersID);
}
void ARenderTargetReplicationProxy::ReceiveTextureBlob_Implementation(const TArray<uint8>& TextureBlob, int32 LocationInData, int32 BlobNumber)

View file

@ -1,207 +0,0 @@
#include "Mover/VRMoverComponent.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(VRMoverComponent)
#include "VRBPDatatypes.h"
#include "DefaultMovementSet\LayeredMoves\BasicLayeredMoves.h"
#include "Engine/BlueprintGeneratedClass.h"
#include "Curves\CurveFloat.h" // Delete after tests, only needed for cloning
#include "ReplicatedVRCameraComponent.h"
DEFINE_LOG_CATEGORY(LogVRMoverComponent);
static const FName Name_CharacterMotionComponent(TEXT("MoverComponent"));
/*
Layered move to inject VR movement into the mover component
*/
FLayeredMove_VRMovement::FLayeredMove_VRMovement()
: Velocity(FVector::ZeroVector)
, MagnitudeOverTime(nullptr)
, SettingsFlags(0)
{
// This should never end
DurationMs = -1.0f;
}
bool FLayeredMove_VRMovement::IsFinished(float CurrentSimTimeMs) const
{
// We never end the VR velocity injection
return false;
}
bool FLayeredMove_VRMovement::GenerateMove(const FMoverTickStartData& SimState, const FMoverTimeStep& TimeStep, const UMoverComponent* MoverComp, UMoverBlackboard* SimBlackboard, FProposedMove& OutProposedMove)
{
const FMoverDefaultSyncState* SyncState = SimState.SyncState.SyncStateCollection.FindDataByType<FMoverDefaultSyncState>();
check(SyncState);
const float DeltaSeconds = TimeStep.StepMs * 0.001f;
// Convert starting velocity based on starting orientation, if settings call for it
if (SettingsFlags & (uint8)ELayeredMove_ConstantVelocitySettingsFlags::VelocityStartRelative &&
StartSimTimeMs == TimeStep.BaseSimTimeMs)
{
SettingsFlags &= ~(uint8)ELayeredMove_ConstantVelocitySettingsFlags::VelocityStartRelative;
Velocity = SyncState->GetOrientation_WorldSpace().RotateVector(Velocity);
}
FVector VelocityThisFrame = Velocity;
// Put velocity into worldspace
if (SettingsFlags & (uint8)ELayeredMove_ConstantVelocitySettingsFlags::VelocityAlwaysRelative)
{
VelocityThisFrame = SyncState->GetOrientation_WorldSpace().RotateVector(Velocity);
}
if (MagnitudeOverTime && DurationMs > 0)
{
const float TimeValue = DurationMs > 0.f ? FMath::Clamp((TimeStep.BaseSimTimeMs - StartSimTimeMs) / DurationMs, 0.f, 1.f) : TimeStep.BaseSimTimeMs;
const float TimeFactor = MagnitudeOverTime->GetFloatValue(TimeValue);
VelocityThisFrame *= TimeFactor;
}
OutProposedMove.LinearVelocity = VelocityThisFrame;
return true;
}
FLayeredMoveBase* FLayeredMove_VRMovement::Clone() const
{
FLayeredMove_VRMovement* CopyPtr = new FLayeredMove_VRMovement(*this);
return CopyPtr;
}
void FLayeredMove_VRMovement::NetSerialize(FArchive& Ar)
{
Super::NetSerialize(Ar);
SerializePackedVector<10, 16>(Velocity, Ar);
Ar << SettingsFlags;
Ar << MagnitudeOverTime;
}
UScriptStruct* FLayeredMove_VRMovement::GetScriptStruct() const
{
return FLayeredMove_VRMovement::StaticStruct();
}
FString FLayeredMove_VRMovement::ToSimpleString() const
{
return FString::Printf(TEXT("LinearVelocity"));
}
void FLayeredMove_VRMovement::AddReferencedObjects(class FReferenceCollector& Collector)
{
Super::AddReferencedObjects(Collector);
}
/*
VR HMD Sync State to store the HMD velocities
Which should be pulled from input somehow
*/
FMoverDataStructBase* FVRMoverHMDSyncState::Clone() const
{
// TODO: ensure that this memory allocation jives with deletion method
FVRMoverHMDSyncState* CopyPtr = new FVRMoverHMDSyncState(*this);
return CopyPtr;
}
bool FVRMoverHMDSyncState::NetSerialize(FArchive& Ar, UPackageMap* Map, bool& bOutSuccess)
{
Super::NetSerialize(Ar, Map, bOutSuccess);
SerializeFixedVector<2, 8>(MoveDirectionIntent, Ar);
bOutSuccess = true;
return true;
}
AVRMoverBasePawn::AVRMoverBasePawn(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
CharacterMotionComponent = CreateDefaultSubobject<UMoverComponent>(Name_CharacterMotionComponent);
ensure(CharacterMotionComponent);
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
SetReplicatingMovement(false); // disable Actor-level movement replication, since our Mover component will handle it
// Let the code know if blueprints have implemented input
auto IsImplementedInBlueprint = [](const UFunction* Func) -> bool
{
return Func && ensure(Func->GetOuter())
&& Func->GetOuter()->IsA(UBlueprintGeneratedClass::StaticClass());
};
static FName ProduceInputBPFuncName = FName(TEXT("OnProduceInputInBlueprint"));
UFunction* ProduceInputFunction = GetClass()->FindFunctionByName(ProduceInputBPFuncName);
bHasProduceInputinBpFunc = IsImplementedInBlueprint(ProduceInputFunction);
}
void AVRMoverBasePawn::BeginPlay()
{
Super::BeginPlay();
// In constructor for the data instead of begin play? Might even be able to queue the layered move there too
if (IsValid(CharacterMotionComponent))
{
// Add the sync data for our layered HMD movement injection
CharacterMotionComponent->PersistentSyncStateDataTypes.Add(FMoverDataPersistence(FVRMoverHMDSyncState::StaticStruct(), true));
// Needs to be handled off of possession instead?
if (HasLocalNetOwner())
{
// Add the persistant HMDlayered move addition
TSharedPtr<FLayeredMove_VRMovement> VRMoveLayer = MakeShared<FLayeredMove_VRMovement>();
CharacterMotionComponent->QueueLayeredMove(VRMoveLayer);
}
}
}
UPrimitiveComponent* AVRMoverBasePawn::GetMovementBase() const
{
return CharacterMotionComponent ? CharacterMotionComponent->GetMovementBase() : nullptr;
}
void AVRMoverBasePawn::ProduceInput_Implementation(int32 SimTimeMs, FMoverInputCmdContext& InputCmdResult)
{
OnProduceInput((float)SimTimeMs, InputCmdResult);
if (bHasProduceInputinBpFunc)
{
InputCmdResult = OnProduceInputInBlueprint((float)SimTimeMs, InputCmdResult);
}
}
void AVRMoverBasePawn::OnProduceInput(float DeltaMs, FMoverInputCmdContext& OutInputCmd)
{
// Generate user commands. Called right before the Character movement simulation will tick (for a locally controlled pawn)
// This isn't meant to be the best way of doing a camera system. It is just meant to show a couple of ways it may be done
// and to make sure we can keep distinct the movement, rotation, and view angles.
// Styles 1-3 are really meant to be used with a gamepad.
//
// Its worth calling out: the code that happens here is happening *outside* of the Character movement simulation. All we are doing
// is generating the input being fed into that simulation. That said, this means that A) the code below does not run on the server
// (and non controlling clients) and B) the code is not rerun during reconcile/resimulates. Use this information guide any
// decisions about where something should go (such as aim assist, lock on targeting systems, etc): it is hard to give absolute
// answers and will depend on the game and its specific needs. In general, at this time, I'd recommend aim assist and lock on
// targeting systems to happen /outside/ of the system, i.e, here. But I can think of scenarios where that may not be ideal too.
//FCharacterDefaultInputs& CharacterInputs = OutInputCmd.InputCollection.FindOrAddMutableDataByType<FVRCharacterExtendedInputs>();
}

View file

@ -3,7 +3,6 @@
#include "ParentRelativeAttachmentComponent.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(ParentRelativeAttachmentComponent)
#include "Engine/Engine.h"
#include "VRBaseCharacter.h"
#include "VRCharacter.h"
#include "IXRTrackingSystem.h"

View file

@ -3,9 +3,6 @@
#include "ReplicatedVRCameraComponent.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(ReplicatedVRCameraComponent)
#include "CoreMinimal.h"
#include "Engine/Engine.h"
#include "Engine/World.h"
#include "Net/UnrealNetwork.h"
#include "VRBaseCharacter.h"
#include "VRCharacter.h"
@ -14,9 +11,6 @@
#include "IXRCamera.h"
#include "Rendering/MotionVectorSimulation.h"
#if WITH_PUSH_MODEL
#include "Net/Core/PushModel/PushModel.h"
#endif
UReplicatedVRCameraComponent::UReplicatedVRCameraComponent(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
@ -47,6 +41,7 @@ UReplicatedVRCameraComponent::UReplicatedVRCameraComponent(const FObjectInitiali
MaximumTrackedBounds = 1028;
bSetPositionDuringTick = false;
bSmoothReplicatedMotion = false;
bLerpingPosition = false;
bReppedOnce = false;
@ -75,27 +70,28 @@ void UReplicatedVRCameraComponent::GetLifetimeReplicatedProps(TArray< class FLif
DISABLE_REPLICATED_PRIVATE_PROPERTY(USceneComponent, RelativeRotation);
DISABLE_REPLICATED_PRIVATE_PROPERTY(USceneComponent, RelativeScale3D);
// For properties with special conditions
FDoRepLifetimeParams PushModelParamsWithCondition{ COND_SkipOwner, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
// Skipping the owner with this as the owner will use the location directly
DOREPLIFETIME_WITH_PARAMS_FAST(UReplicatedVRCameraComponent, ReplicatedCameraTransform, PushModelParamsWithCondition);
// For std properties
FDoRepLifetimeParams PushModelParams{ COND_None, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(UReplicatedVRCameraComponent, NetUpdateRate, PushModelParams);
//DOREPLIFETIME(UReplicatedVRCameraComponent, bSmoothReplicatedMotion); // This doesn't need to be replicated
DOREPLIFETIME_CONDITION(UReplicatedVRCameraComponent, ReplicatedCameraTransform, COND_SkipOwner);
DOREPLIFETIME(UReplicatedVRCameraComponent, NetUpdateRate);
DOREPLIFETIME(UReplicatedVRCameraComponent, bSmoothReplicatedMotion);
//DOREPLIFETIME(UReplicatedVRCameraComponent, bReplicateTransform);
}
// Just skipping this, it generates warnings for attached meshes when using this method of denying transform replication
/*void UReplicatedVRCameraComponent::PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker)
{
Super::PreReplication(ChangedPropertyTracker);
// Don't ever replicate these, they are getting replaced by my custom send anyway
DOREPLIFETIME_ACTIVE_OVERRIDE(USceneComponent, RelativeLocation, false);
DOREPLIFETIME_ACTIVE_OVERRIDE(USceneComponent, RelativeRotation, false);
DOREPLIFETIME_ACTIVE_OVERRIDE(USceneComponent, RelativeScale3D, false);
}*/
void UReplicatedVRCameraComponent::Server_SendCameraTransform_Implementation(FBPVRComponentPosRep NewTransform)
{
// Store new transform and trigger OnRep_Function
ReplicatedCameraTransform = NewTransform;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UReplicatedVRCameraComponent, ReplicatedCameraTransform, this);
#endif
// Don't call on rep on the server if the server controls this controller
if (!bHasAuthority)
@ -407,10 +403,6 @@ void UReplicatedVRCameraComponent::TickComponent(float DeltaTime, enum ELevelTic
ReplicatedCameraTransform.Rotation = RelativeRot;
}
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UReplicatedVRCameraComponent, ReplicatedCameraTransform, this);
#endif
if (GetNetMode() == NM_Client)
{
AVRBaseCharacter* OwningChar = Cast<AVRBaseCharacter>(GetOwner());
@ -514,11 +506,6 @@ void UReplicatedVRCameraComponent::HandleXRCamera()
}
}
FTransform UReplicatedVRCameraComponent::GetHMDTrackingTransform()
{
return FTransform(ReplicatedCameraTransform.Rotation, ReplicatedCameraTransform.Position);
}
void UReplicatedVRCameraComponent::OnRep_ReplicatedCameraTransform()
{
if (GetNetMode() < ENetMode::NM_Client && HasTrackingParameters())
@ -584,18 +571,3 @@ void UReplicatedVRCameraComponent::OnRep_ReplicatedCameraTransform()
else
SetRelativeLocationAndRotation(CameraPosition, ReplicatedCameraTransform.Rotation);
}
void UReplicatedVRCameraComponent::SetNetUpdateRate(float NewNetUpdateRate)
{
NetUpdateRate = NewNetUpdateRate;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(UReplicatedVRCameraComponent, NetUpdateRate, this);
#endif
}
bool UReplicatedVRCameraComponent::IsLocallyControlled() const
{
// I like epics new authority check more than my own
const AActor* MyOwner = GetOwner();
return MyOwner->HasLocalNetOwner();
}

View file

@ -4,8 +4,6 @@
#include UE_INLINE_GENERATED_CPP_BY_NAME(VRAIController)
//#include "VRBPDatatypes.h"
#include "CoreMinimal.h"
#include "Engine/World.h"
#include "VRBaseCharacter.h"
#include "Components/CapsuleComponent.h"
#include "NetworkingDistanceConstants.h" // Needed for the LinOfSightTo function override to work

View file

@ -3,9 +3,6 @@
#include "VRBPDatatypes.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(VRBPDatatypes)
#include "CoreMinimal.h"
#include "VRGlobalSettings.h"
#include "Components\PrimitiveComponent.h"
#include "HAL/IConsoleManager.h"
#include "Chaos/ChaosEngineInterface.h"
@ -222,71 +219,3 @@ FTransform FBPEuroLowPassFilterTrans::RunFilterSmoothing(const FTransform& InRaw
// Filter passed value
return NewTrans;
}
bool FBPAdvancedPhysicsHandleSettings::FillTo(FBPActorPhysicsHandleInformation* HandleInfo, bool bModifyWithScalers) const
{
if (!HandleInfo)
return false;
float DampingMod = 0.0f;
float StiffnessMod = 0.0f;
float ADampingMod = 0.0f;
float AStiffnessMod = 0.0f;
const UVRGlobalSettings& VRSettings = *GetDefault<UVRGlobalSettings>();
if (VRSettings.bUseChaosTranslationScalers)
{
StiffnessMod = VRSettings.LinearDriveStiffnessScale;
DampingMod = VRSettings.LinearDriveDampingScale;
AStiffnessMod = VRSettings.AngularDriveStiffnessScale;
ADampingMod = VRSettings.AngularDriveDampingScale;
}
else
{
auto CVarLinearDriveStiffnessScale = IConsoleManager::Get().FindConsoleVariable(TEXT("p.Chaos.JointConstraint.LinearDriveStiffnessScale"));
auto CVarLinearDriveDampingScale = IConsoleManager::Get().FindConsoleVariable(TEXT("p.Chaos.JointConstraint.LinaearDriveDampingScale"));
auto CVarAngularDriveStiffnessScale = IConsoleManager::Get().FindConsoleVariable(TEXT("p.Chaos.JointConstraint.AngularDriveStiffnessScale"));
auto CVarAngularDriveDampingScale = IConsoleManager::Get().FindConsoleVariable(TEXT("p.Chaos.JointConstraint.AngularDriveDampingScale"));
StiffnessMod = CVarLinearDriveStiffnessScale->GetFloat();
DampingMod = CVarLinearDriveDampingScale->GetFloat();
AStiffnessMod = CVarAngularDriveStiffnessScale->GetFloat();
ADampingMod = CVarAngularDriveDampingScale->GetFloat();
}
XAxisSettings.FillTo(HandleInfo->LinConstraint.XDrive, DampingMod, StiffnessMod);
YAxisSettings.FillTo(HandleInfo->LinConstraint.YDrive, DampingMod, StiffnessMod);
ZAxisSettings.FillTo(HandleInfo->LinConstraint.ZDrive, DampingMod, StiffnessMod);
if ((SlerpSettings.bEnablePositionDrive || SlerpSettings.bEnableVelocityDrive))
{
HandleInfo->AngConstraint.AngularDriveMode = EAngularDriveMode::SLERP;
SlerpSettings.FillTo(HandleInfo->AngConstraint.SlerpDrive, ADampingMod, AStiffnessMod);
}
else
{
HandleInfo->AngConstraint.AngularDriveMode = EAngularDriveMode::TwistAndSwing;
TwistSettings.FillTo(HandleInfo->AngConstraint.TwistDrive, ADampingMod, AStiffnessMod);
SwingSettings.FillTo(HandleInfo->AngConstraint.SwingDrive, ADampingMod, AStiffnessMod);
}
return true;
}
AActor* FBPActorGripInformation::GetGrippedActor() const
{
return Cast<AActor>(GrippedObject);
}
UPrimitiveComponent* FBPActorGripInformation::GetGrippedComponent() const
{
return Cast<UPrimitiveComponent>(GrippedObject);
}
bool FBPActorGripInformation::operator==(const UPrimitiveComponent* Other) const
{
if (Other && GrippedObject && GrippedObject == (const UObject*)Other)
return true;
return false;
}

View file

@ -14,13 +14,8 @@
#include "VRPathFollowingComponent.h"
#include "Net/UnrealNetwork.h"
#include "XRMotionControllerBase.h"
#include "NavFilters/NavigationQueryFilter.h"
//#include "Runtime/Engine/Private/EnginePrivate.h"
#if WITH_PUSH_MODEL
#include "Net/Core/PushModel/PushModel.h"
#endif
DEFINE_LOG_CATEGORY(LogBaseVRCharacter);
FName AVRBaseCharacter::LeftMotionControllerComponentName(TEXT("Left Grip Motion Controller"));
@ -240,24 +235,13 @@ void AVRBaseCharacter::PostInitializeComponents()
void AVRBaseCharacter::GetLifetimeReplicatedProps(TArray< class FLifetimeProperty > & OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// For std properties
FDoRepLifetimeParams PushModelParams{ COND_None, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(AVRBaseCharacter, SeatInformation, PushModelParams);
DOREPLIFETIME_WITH_PARAMS_FAST(AVRBaseCharacter, VRReplicateCapsuleHeight, PushModelParams);
// For properties with special conditions
FDoRepLifetimeParams PushModelParamsWithCondition{ COND_SimulatedOnly, REPNOTIFY_OnChanged, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(AVRBaseCharacter, ReplicatedCapsuleHeight, PushModelParamsWithCondition);
DOREPLIFETIME_CONDITION(AVRBaseCharacter, SeatInformation, COND_None);
DOREPLIFETIME_CONDITION(AVRBaseCharacter, VRReplicateCapsuleHeight, COND_None);
DOREPLIFETIME_CONDITION(AVRBaseCharacter, ReplicatedCapsuleHeight, COND_SimulatedOnly);
DISABLE_REPLICATED_PRIVATE_PROPERTY(AActor, ReplicatedMovement);
// For properties with special conditions
FDoRepLifetimeParams PushModelParamsReplicatedMovement{ COND_SimulatedOrPhysics, REPNOTIFY_Always, /*bIsPushBased=*/true };
DOREPLIFETIME_WITH_PARAMS_FAST(AVRBaseCharacter, ReplicatedMovementVR, PushModelParamsReplicatedMovement);
DOREPLIFETIME_CONDITION_NOTIFY(AVRBaseCharacter, ReplicatedMovementVR, COND_SimulatedOrPhysics, REPNOTIFY_Always);
}
void AVRBaseCharacter::PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker)
@ -299,10 +283,6 @@ void AVRBaseCharacter::Server_ReZeroSeating_Implementation(FTransform_NetQuantiz
SeatInformation.StoredTargetTransform.AddToTranslation(FVector(0, 0, -newLocation.Z));
}
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(AVRBaseCharacter, SeatInformation, this);
#endif
OnRep_SeatedCharInfo();
}
@ -477,10 +457,6 @@ void AVRBaseCharacter::GatherCurrentMovement()
ReplicatedMovementVR.PausedTrackingLoc = PausedTrackingLoc;
ReplicatedMovementVR.PausedTrackingRot = PausedTrackingRot;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(AVRBaseCharacter, ReplicatedMovementVR, this);
#endif
}
@ -808,7 +784,7 @@ bool AVRBaseCharacter::SetSeatedMode(USceneComponent * SeatParent, bool bSetSeat
// I think we can remove the initial value alltogether eventually right?
if (!bRetainRoomscale && VRReplicatedCamera)
{
InitialRelCameraTransform = VRReplicatedCamera->GetHMDTrackingTransform();
InitialRelCameraTransform = FTransform(VRReplicatedCamera->ReplicatedCameraTransform.Rotation, VRReplicatedCamera->ReplicatedCameraTransform.Position, VRReplicatedCamera->GetComponentScale());
}
SeatInformation.SeatParent = SeatParent;
@ -829,10 +805,6 @@ bool AVRBaseCharacter::SetSeatedMode(USceneComponent * SeatParent, bool bSetSeat
SeatInformation.StoredTargetTransform.AddToTranslation(FVector(0, 0, -newLocation.Z));
}
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(AVRBaseCharacter, SeatInformation, this);
#endif
//SetReplicateMovement(false);/ / No longer doing this, allowing it to replicate down to simulated clients now instead
}
else
@ -843,9 +815,6 @@ bool AVRBaseCharacter::SetSeatedMode(USceneComponent * SeatParent, bool bSetSeat
//SetReplicateMovement(true); // No longer doing this, allowing it to replicate down to simulated clients now instead
SeatInformation.bSitting = false;
}
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(AVRBaseCharacter, SeatInformation, this);
#endif
OnRep_SeatedCharInfo(); // Call this on server side because it won't call itself
NotifyOfTeleport(); // Teleport the controllers
@ -1236,11 +1205,3 @@ void AVRBaseCharacter::StopNavigationMovement()
pathComp->AbortMove(*this, FPathFollowingResultFlags::MovementStop | FPathFollowingResultFlags::ForcedScript);
}
}
void AVRBaseCharacter::SetVRReplicateCapsuleHeight(bool bNewVRReplicateCapsuleHeight)
{
VRReplicateCapsuleHeight = bNewVRReplicateCapsuleHeight;
#if WITH_PUSH_MODEL
MARK_PROPERTY_DIRTY_FROM_NAME(AVRBaseCharacter, VRReplicateCapsuleHeight, this);
#endif
}

View file

@ -19,7 +19,6 @@
#include "Navigation/PathFollowingComponent.h"
#include "VRPlayerController.h"
#include "GameFramework/PhysicsVolume.h"
#include "Animation\AnimInstance.h"
DEFINE_LOG_CATEGORY(LogVRBaseCharacterMovement);
@ -1894,9 +1893,6 @@ void UVRBaseCharacterMovementComponent::MoveAutonomous(
const bool bWasPlayingRootMotion = CharacterOwner->IsPlayingRootMotion();
// Scope these, they nest with Outer references so it should work fine, this keeps the update rotation and move autonomous from double updating the char
//const FScopedPreventAttachedComponentMove PreventMeshMove(BaseVRCharacterOwner ? BaseVRCharacterOwner->NetSmoother : nullptr);
PerformMovement(DeltaTime);
// Check if data is valid as PerformMovement can mark character for pending kill
@ -1914,31 +1910,12 @@ void UVRBaseCharacterMovementComponent::MoveAutonomous(
}
// TODO: SaveBaseLocation() in case tick moves us?
USkeletalMeshComponent* OwnerMesh = CharacterOwner->GetMesh();
check(OwnerMesh != nullptr)
static const auto CVarEnableQueuedAnimEventsOnServer = IConsoleManager::Get().FindConsoleVariable(TEXT("a.EnableQueuedAnimEventsOnServer"));
if (CVarEnableQueuedAnimEventsOnServer->GetInt())
if (!CVarEnableQueuedAnimEventsOnServer->GetInt() || CharacterOwner->GetMesh()->ShouldOnlyTickMontages(DeltaTime))
{
if (const UAnimInstance* AnimInstance = OwnerMesh->GetAnimInstance())
{
if (OwnerMesh->VisibilityBasedAnimTickOption <= EVisibilityBasedAnimTickOption::AlwaysTickPose && AnimInstance->NeedsUpdate())
{
// If we are doing a full graph update on the server but its doing a parallel update,
// trigger events right away since these are notifies queued from the montage update and we could be receiving multiple ServerMoves per frame.
OwnerMesh->ConditionallyDispatchQueuedAnimEvents();
OwnerMesh->AllowQueuedAnimEventsNextDispatch();
}
}
}
else
{
// Revert back to old behavior if wanted/needed.
if (OwnerMesh->ShouldOnlyTickMontages(DeltaTime))
{
OwnerMesh->ConditionallyDispatchQueuedAnimEvents();
}
// If we're not doing a full anim graph update on the server,
// trigger events right away, as we could be receiving multiple ServerMoves per frame.
CharacterOwner->GetMesh()->ConditionallyDispatchQueuedAnimEvents();
}
}
@ -2258,10 +2235,9 @@ void UVRBaseCharacterMovementComponent::UpdateFromCompressedFlags(uint8 Flags)
FVector UVRBaseCharacterMovementComponent::RoundDirectMovement(FVector InMovement) const
{
// Match FVector_NetQuantize100 (2 decimal place of precision).
UE::Net::QuantizeVector(100, InMovement);
//InMovement.X = FMath::RoundToFloat(InMovement.X * 100.f) / 100.f;
//InMovement.Y = FMath::RoundToFloat(InMovement.Y * 100.f) / 100.f;
//InMovement.Z = FMath::RoundToFloat(InMovement.Z * 100.f) / 100.f;
InMovement.X = FMath::RoundToFloat(InMovement.X * 100.f) / 100.f;
InMovement.Y = FMath::RoundToFloat(InMovement.Y * 100.f) / 100.f;
InMovement.Z = FMath::RoundToFloat(InMovement.Z * 100.f) / 100.f;
return InMovement;
}
@ -2408,5 +2384,5 @@ bool UVRBaseCharacterMovementComponent::SetCharacterToNewGravity(FVector NewGrav
return true;
}
//return false;
return false;
}

View file

@ -14,7 +14,6 @@
#include "GameFramework/Controller.h"
#include "Runtime/Launch/Resources/Version.h"
#include "VRPathFollowingComponent.h"
#include "NavFilters/NavigationQueryFilter.h"
//#include "Runtime/Engine/Private/EnginePrivate.h"
DEFINE_LOG_CATEGORY(LogVRCharacter);

View file

@ -457,7 +457,7 @@ void FSavedMove_VRCharacter::PrepMoveFor(ACharacter* Character)
if (AVRBaseCharacter * BaseChar = Cast<AVRBaseCharacter>(CharMove->GetCharacterOwner()))
{
if (BaseChar->GetVRReplicateCapsuleHeight() && this->CapsuleHeight > 0.0f && !FMath::IsNearlyEqual(this->CapsuleHeight, CharMove->VRRootCapsule->GetUnscaledCapsuleHalfHeight()))
if (BaseChar->VRReplicateCapsuleHeight && this->CapsuleHeight > 0.0f && !FMath::IsNearlyEqual(this->CapsuleHeight, CharMove->VRRootCapsule->GetUnscaledCapsuleHalfHeight()))
{
BaseChar->SetCharacterHalfHeightVR(CapsuleHeight, false);
//CharMove->VRRootCapsule->SetCapsuleHalfHeight(this->LFDiff.Z, false);
@ -566,10 +566,6 @@ void UVRCharacterMovementComponent::ServerMove_PerformMovement(const FCharacterN
DeltaTime = ServerData->GetServerMoveDeltaTime(ClientTimeStamp, CharacterOwner->GetActorTimeDilation(*MyWorld));
}
// They added a scope here, im not using it as im doing the full capsule above
// Scope these, they nest with Outer references so it should work fine, this keeps the update rotation and move autonomous from double updating the char
//const FScopedPreventAttachedComponentMove PreventMeshMove(BaseVRCharacterOwner ? BaseVRCharacterOwner->NetSmoother : nullptr);
if (DeltaTime > 0.f)
{
ServerData->CurrentClientTimeStamp = ClientTimeStamp;
@ -619,7 +615,7 @@ void UVRCharacterMovementComponent::ServerMove_PerformMovement(const FCharacterN
if (BaseVRCharacterOwner)
{
if (BaseVRCharacterOwner->GetVRReplicateCapsuleHeight() && MoveDataVR->CapsuleHeight > 0.0f && !FMath::IsNearlyEqual(MoveDataVR->CapsuleHeight, VRRootCapsule->GetUnscaledCapsuleHalfHeight()))
if (BaseVRCharacterOwner->VRReplicateCapsuleHeight && MoveDataVR->CapsuleHeight > 0.0f && !FMath::IsNearlyEqual(MoveDataVR->CapsuleHeight, VRRootCapsule->GetUnscaledCapsuleHalfHeight()))
{
BaseVRCharacterOwner->SetCharacterHalfHeightVR(MoveDataVR->CapsuleHeight, false);
// BaseChar->ReplicatedCapsuleHeight.CapsuleHeight = LFDiff.Z;
@ -900,9 +896,6 @@ void UVRCharacterMovementComponent::PhysWalking(float deltaTime, int32 Iteration
bool bTriedLedgeMove = false;
float remainingTime = deltaTime;
const EMovementMode StartingMovementMode = MovementMode;
const uint8 StartingCustomMovementMode = CustomMovementMode;
// Rewind the players position by the new capsule location
RewindVRRelativeMovement();
@ -944,9 +937,9 @@ void UVRCharacterMovementComponent::PhysWalking(float deltaTime, int32 Iteration
devCodeVR(ensureMsgf(!Velocity.ContainsNaN(), TEXT("PhysWalking: Velocity contains NaN after Root Motion application (%s)\n%s"), *GetPathNameSafe(this), *Velocity.ToString()));
if (MovementMode != StartingMovementMode || CustomMovementMode != StartingCustomMovementMode)
if (IsFalling())
{
// Root motion could have taken us out of our current mode
// Root motion could have put us into Falling.
// No movement has taken place this movement tick so we pass on full time/past iteration count
StartNewPhysics(remainingTime + timeTick, Iterations - 1);
return;
@ -987,15 +980,9 @@ void UVRCharacterMovementComponent::PhysWalking(float deltaTime, int32 Iteration
// try to move forward
MoveAlongFloor(MoveVelocity, timeTick, &StepDownResult);
if (IsSwimming()) //just entered water
if (IsFalling())
{
StartSwimming(OldLocation, OldVelocity, timeTick, remainingTime, Iterations);
return;
}
else if (MovementMode != StartingMovementMode || CustomMovementMode != StartingCustomMovementMode)
{
// pawn ended up in a different mode, probably due to the step-up-and-over flow
// let's refund the estimated unused time (if any) and keep moving in the new mode
// pawn decided to jump up
const float DesiredDist = Delta.Size();
if (DesiredDist > UE_KINDA_SMALL_NUMBER)
{
@ -1006,6 +993,12 @@ void UVRCharacterMovementComponent::PhysWalking(float deltaTime, int32 Iteration
StartNewPhysics(remainingTime, Iterations);
return;
}
else if (IsSwimming()) //just entered water
{
RestorePreAdditiveVRMotionVelocity();
StartSwimmingVR(OldCapsuleLocation, OldVelocity, timeTick, remainingTime, Iterations);
return;
}
}
// Update floor.
@ -1303,7 +1296,8 @@ void UVRCharacterMovementComponent::ReplicateMoveToServer(float DeltaTime, const
// Remove pending move from move list. It would have to be the last move on the list.
if (ClientData->SavedMoves.Num() > 0 && ClientData->SavedMoves.Last() == ClientData->PendingMove)
{
ClientData->SavedMoves.Pop(EAllowShrinking::No);
const bool bAllowShrinking = false;
ClientData->SavedMoves.Pop(bAllowShrinking);
}
ClientData->FreeMove(ClientData->PendingMove);
ClientData->PendingMove = nullptr;
@ -2299,17 +2293,6 @@ void UVRCharacterMovementComponent::UpdateBasedMovement(float DeltaSeconds)
}
else
{
// Set MovementBase's root actor as ignored when moving the character primitive component,
// only perform if bDeferUpdateBasedMovement is true since this means the MovementBase is simulating physics
const bool bIgnoreBaseActor = bDeferUpdateBasedMovement && bBasedMovementIgnorePhysicsBase;
AActor* MovementBaseRootActor = nullptr;
if (bIgnoreBaseActor)
{
MovementBaseRootActor = MovementBase->GetAttachmentRootActor();
UpdatedPrimitive->IgnoreActorWhenMoving(MovementBaseRootActor, true);
MoveComponentFlags |= MOVECOMP_CheckBlockingRootActorInIgnoreList; // Hit actors during MoveUpdatedComponent will have their root actor compared with the ignored actors array
}
// hack - transforms between local and world space introducing slight error FIXMESTEVE - discuss with engine team: just skip the transforms if no rotation?
FVector BaseMoveDelta = NewBaseLocation - OldBaseLocation;
if (!bRotationChanged && (BaseMoveDelta.X == 0.f) && (BaseMoveDelta.Y == 0.f))
@ -2321,18 +2304,10 @@ void UVRCharacterMovementComponent::UpdateBasedMovement(float DeltaSeconds)
FHitResult MoveOnBaseHit(1.f);
const FVector OldLocation = UpdatedComponent->GetComponentLocation();
MoveUpdatedComponent(DeltaPosition, FinalQuat, true, &MoveOnBaseHit);
if ((UpdatedComponent->GetComponentLocation() - (OldLocation + DeltaPosition)).IsNearlyZero() == false)
{
OnUnableToFollowBaseMove(DeltaPosition, OldLocation, MoveOnBaseHit);
}
// Reset base actor ignore state
if (bIgnoreBaseActor)
{
MoveComponentFlags &= ~MOVECOMP_CheckBlockingRootActorInIgnoreList;
UpdatedPrimitive->IgnoreActorWhenMoving(MovementBaseRootActor, false);
}
}
if (MovementBase->IsSimulatingPhysics() && CharacterOwner->GetMesh())
@ -2340,27 +2315,6 @@ void UVRCharacterMovementComponent::UpdateBasedMovement(float DeltaSeconds)
CharacterOwner->GetMesh()->ApplyDeltaToAllPhysicsTransforms(DeltaPosition, DeltaQuat);
}
}
// Check if falling above current base
if (IsFalling() && bStayBasedInAir)
{
FVector PawnLocation = UpdatedComponent->GetComponentLocation();
if (VRRootCapsule)
PawnLocation = VRRootCapsule->OffsetComponentToWorld.GetLocation();
FFindFloorResult OutFloorResult;
ComputeFloorDist(PawnLocation, StayBasedInAirHeight, StayBasedInAirHeight, OutFloorResult, CharacterOwner->GetCapsuleComponent()->GetScaledCapsuleRadius(), NULL);
UPrimitiveComponent* HitComponent = OutFloorResult.HitResult.Component.Get();
if (!HitComponent || HitComponent->GetAttachmentRoot() != MovementBase->GetAttachmentRoot())
{
// New or no base under the character
ApplyImpartedMovementBaseVelocity();
SetBase(NULL);
return;
}
}
}
FVector UVRCharacterMovementComponent::GetImpartedMovementBaseVelocity() const
@ -3165,9 +3119,6 @@ void UVRCharacterMovementComponent::PhysNavWalking(float deltaTime, int32 Iterat
return;
}
const EMovementMode StartingMovementMode = MovementMode;
const uint8 StartingCustomMovementMode = CustomMovementMode;
// Rewind the players position by the new capsule location
RewindVRRelativeMovement();
@ -3189,12 +3140,12 @@ void UVRCharacterMovementComponent::PhysNavWalking(float deltaTime, int32 Iterat
ApplyRootMotionToVelocity(deltaTime);
ApplyVRMotionToVelocity(deltaTime);
if (MovementMode != StartingMovementMode || CustomMovementMode != StartingCustomMovementMode)
/*if (IsFalling())
{
// Root motion could have taken us out of our current mode
// Root motion could have put us into Falling
StartNewPhysics(deltaTime, Iterations);
return;
}
}*/
Iterations++;
@ -4436,14 +4387,6 @@ void UVRCharacterMovementComponent::ServerMoveHandleClientErrorVR(float ClientTi
bCanTrustClientOnLanding = false;
}
// They have it private....
// Check for lift-off, going from walking to falling.
// Note that if bStayBasedInAir is enabled we can't rely on the walking to falling transition, instead run logic on the first tick after clearing the MovementBase
//const bool bCanLiftOffFromBase = bStayBasedInAir
// ? !MovementBase && LastServerMovementBase.Get() // If we keep the base while in air, consider lift-off if base gets set to null and we had a base last tick
// : bLastServerIsWalking; // If walking last tick, we were can consider lift-off logic
//if (bServerIsFalling && bCanLiftOffFromBase && !bTeleportedSinceLastUpdate)
if (bServerIsFalling && bLastServerIsWalking && !bTeleportedSinceLastUpdate)
{
float ClientForwardFactor = 1.f;
@ -4743,9 +4686,6 @@ bool UVRCharacterMovementComponent::ClientUpdatePositionAfterServerUpdate()
CharacterOwner->bClientUpdating = true;
bForceNextFloorCheck = true;
// Scope these, they nest with Outer references so it should work fine, this keeps the update rotation and move autonomous from double updating the char
//const FScopedPreventAttachedComponentMove PreventMeshMove(BaseVRCharacterOwner ? BaseVRCharacterOwner->NetSmoother : nullptr);
// Store out our custom properties to restore after replaying
const FVRMoveActionArray Orig_MoveActions = MoveActionArray;
const FVector Orig_CustomInput = CustomVRInputVector;

View file

@ -2,8 +2,6 @@
#include UE_INLINE_GENERATED_CPP_BY_NAME(VRGestureComponent)
#include "VRBaseCharacter.h"
#include "Engine/Engine.h"
#include "Engine/World.h"
#include "Components/SplineMeshComponent.h"
#include "Components/SplineComponent.h"
#include "Components/LineBatchComponent.h"

View file

@ -3,8 +3,6 @@
#include "VRPathFollowingComponent.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(VRPathFollowingComponent)
#include "CoreMinimal.h"
#include "Engine/World.h"
//#include "Runtime/Engine/Private/EnginePrivate.h"
//#if ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION >= 13
@ -256,16 +254,8 @@ void UVRPathFollowingComponent::UpdatePathSegment()
{
const FVector AgentLocation = DestinationAgent ? DestinationAgent->GetNavAgentLocation() : DestinationActor->GetActorLocation();
// note that the condition below requires GoalLocation to be in world space.
FVector GoalLocation = FQuatRotationTranslationMatrix(DestinationActor->GetActorQuat(), AgentLocation).TransformPosition(MoveOffset);
const FVector GoalLocation = FQuatRotationTranslationMatrix(DestinationActor->GetActorQuat(), AgentLocation).TransformPosition(MoveOffset);
if (bMoveToGoalClampedToNavigation && NavigationFilter)
{
FVector HitLocation;
if (MyNavData->Raycast(CurrentLocation, GoalLocation, HitLocation, NavigationFilter))
{
GoalLocation = HitLocation;
}
}
CurrentDestination.Set(NULL, GoalLocation);
//UE_VLOG(this, LogPathFollowing, Log, TEXT("Moving directly to move goal rather than following last path segment"));
@ -371,27 +361,6 @@ bool UVRPathFollowingComponent::HasReachedCurrentTarget(const FVector& CurrentLo
return false;
}
// If the next segment is a link with a custom reach condition, we need to call the HasReachedLinkStart on the link interface.
if (bMoveSegmentIsUsingCustomLinkReachCondition)
{
if (const INavLinkCustomInterface* MoveSegmentCustomLink = Cast<const INavLinkCustomInterface>(MoveSegmentCustomLinkOb.Get()))
{
if (ensureMsgf(Path.IsValid(), TEXT("%hs: Path should be valid when we get here. Owner [%s]."), __FUNCTION__, *GetNameSafe(GetOwner())))
{
const FNavPathPoint& LinkStart = Path->GetPathPoints()[MoveSegmentEndIndex];
if (Path->GetPathPoints().IsValidIndex(MoveSegmentEndIndex + 1))
{
const FNavPathPoint& LinkEnd = Path->GetPathPoints()[MoveSegmentEndIndex + 1];
return MoveSegmentCustomLink->HasReachedLinkStart(this, CurrentLocation, LinkStart, LinkEnd);
}
else
{
UE_LOG(LogPathFollowing, Error, TEXT("%hs: NavLink has a start, but no end. Custom reach condition won't be called. NavLinkID [%llu] - LinkStartPos [%s] - Owner [%s]"), __FUNCTION__, LinkStart.CustomNavLinkId.GetId(), *LinkStart.Location.ToString(), *GetNameSafe(GetOwner()));
}
}
}
}
const FVector CurrentTarget = GetCurrentTargetLocation();
const FVector CurrentDirection = GetCurrentDirection();

View file

@ -27,6 +27,24 @@ void AVRPlayerController::SpawnPlayerCameraManager()
PlayerCameraManager->bUseClientSideCameraUpdates = false;
}
// #TODO 4.20: This was removed
/*void AVRPlayerController::InitNavigationControl(UPathFollowingComponent*& PathFollowingComp)
{
PathFollowingComp = FindComponentByClass<UPathFollowingComponent>();
if (PathFollowingComp == NULL)
{
PathFollowingComp = NewObject<UVRPathFollowingComponent>(this);
PathFollowingComp->RegisterComponentWithWorld(GetWorld());
PathFollowingComp->Initialize();
}
}*/
/*IPathFollowingAgentInterface* AVRPlayerController::GetPathFollowingAgent() const
{
// Moved spawning the path following component into the path finding logic instead
return FNavigationSystem::FindPathFollowingAgentForActor(*this);
}*/
void AVRPlayerController::PlayerTick(float DeltaTime)
{

View file

@ -6,8 +6,6 @@
//#include "Runtime/Engine/Private/EnginePrivate.h"
//#include "WorldCollision.h"
#include "PhysicsPublic.h"
#include "Engine/World.h"
#include "Engine/Engine.h"
#include "Engine/ScopedMovementUpdate.h"
#include "SceneManagement.h"
#include "PrimitiveSceneProxy.h"
@ -15,9 +13,7 @@
#include "IHeadMountedDisplay.h"
#include "IXRTrackingSystem.h"
#include "VRCharacter.h"
#include "Engine/OverlapResult.h"
#include "Algo/Copy.h"
#include "AI/Navigation/NavigationRelevantData.h"
#include "Components/PrimitiveComponent.h"
@ -314,7 +310,6 @@ UVRRootComponent::UVRRootComponent(const FObjectInitializer& ObjectInitializer)
SetCanEverAffectNavigation(false);
bDynamicObstacle = true;
LineThickness = 1.25f;
//bOffsetByHMD = false;
}
@ -338,7 +333,6 @@ public:
, bSimulating(false)
//, OffsetComponentToWorld(InComponent->OffsetComponentToWorld)
, LocalToWorld(InComponent->OffsetComponentToWorld.ToMatrixWithScale())
, LineThickness(InComponent->GetLineThickness())
{
bWillEverBeLit = false;
}
@ -363,14 +357,14 @@ public:
// If in editor views, lets offset the capsule upwards so that it views correctly
if (bSimulating)
{
DrawWireCapsule(PDI, LocalToWorld.GetOrigin() - FVector(0.f, 0.f, CapsuleHalfHeight), LocalToWorld.GetUnitAxis(EAxis::X), LocalToWorld.GetUnitAxis(EAxis::Y), LocalToWorld.GetUnitAxis(EAxis::Z), DrawCapsuleColor, CapsuleRadius, CapsuleHalfHeight, CapsuleSides, SDPG_World, LineThickness);
DrawWireCapsule(PDI, LocalToWorld.GetOrigin() - FVector(0.f, 0.f, CapsuleHalfHeight), LocalToWorld.GetUnitAxis(EAxis::X), LocalToWorld.GetUnitAxis(EAxis::Y), LocalToWorld.GetUnitAxis(EAxis::Z), DrawCapsuleColor, CapsuleRadius, CapsuleHalfHeight, CapsuleSides, SDPG_World);
}
else if (UseEditorCompositing(View))
{
DrawWireCapsule(PDI, LocalToWorld.GetOrigin() /*+ FVector(0.f, 0.f, CapsuleHalfHeight)*/, LocalToWorld.GetUnitAxis(EAxis::X), LocalToWorld.GetUnitAxis(EAxis::Y), LocalToWorld.GetUnitAxis(EAxis::Z), DrawCapsuleColor, CapsuleRadius, CapsuleHalfHeight, CapsuleSides, SDPG_World, LineThickness);
DrawWireCapsule(PDI, LocalToWorld.GetOrigin() /*+ FVector(0.f, 0.f, CapsuleHalfHeight)*/, LocalToWorld.GetUnitAxis(EAxis::X), LocalToWorld.GetUnitAxis(EAxis::Y), LocalToWorld.GetUnitAxis(EAxis::Z), DrawCapsuleColor, CapsuleRadius, CapsuleHalfHeight, CapsuleSides, SDPG_World, 1.25f);
}
else
DrawWireCapsule(PDI, LocalToWorld.GetOrigin(), LocalToWorld.GetUnitAxis(EAxis::X), LocalToWorld.GetUnitAxis(EAxis::Y), LocalToWorld.GetUnitAxis(EAxis::Z), DrawCapsuleColor, CapsuleRadius, CapsuleHalfHeight, CapsuleSides, SDPG_World, LineThickness);
DrawWireCapsule(PDI, LocalToWorld.GetOrigin(), LocalToWorld.GetUnitAxis(EAxis::X), LocalToWorld.GetUnitAxis(EAxis::Y), LocalToWorld.GetUnitAxis(EAxis::Z), DrawCapsuleColor, CapsuleRadius, CapsuleHalfHeight, CapsuleSides, SDPG_World, 1.25f);
}
}
}
@ -411,7 +405,6 @@ private:
bool bSimulating = false;
//FTransform OffsetComponentToWorld;
FMatrix LocalToWorld;
const float LineThickness;
};
FPrimitiveSceneProxy* UVRRootComponent::CreateSceneProxy()
@ -554,10 +547,9 @@ void UVRRootComponent::TickComponent(float DeltaTime, enum ELevelTick TickType,
if (bRetainRoomscale)
{
// Pre-Process this for network sends
UE::Net::QuantizeVector(100, curCameraLoc);
//curCameraLoc.X = FMath::RoundToFloat(curCameraLoc.X * 100.f) / 100.f;
//curCameraLoc.Y = FMath::RoundToFloat(curCameraLoc.Y * 100.f) / 100.f;
//curCameraLoc.Z = FMath::RoundToFloat(curCameraLoc.Z * 100.f) / 100.f;
curCameraLoc.X = FMath::RoundToFloat(curCameraLoc.X * 100.f) / 100.f;
curCameraLoc.Y = FMath::RoundToFloat(curCameraLoc.Y * 100.f) / 100.f;
curCameraLoc.Z = FMath::RoundToFloat(curCameraLoc.Z * 100.f) / 100.f;
}
@ -630,10 +622,9 @@ void UVRRootComponent::TickComponent(float DeltaTime, enum ELevelTick TickType,
lastCameraRot = curCameraRot;
//DifferenceFromLastFrame = (NextTransform.GetLocation() - LastPosition);// .GetSafeNormal2D();
UE::Net::QuantizeVector(100, DifferenceFromLastFrame);
//DifferenceFromLastFrame.X = FMath::RoundToFloat(DifferenceFromLastFrame.X * 100.f) / 100.f;
//DifferenceFromLastFrame.Y = FMath::RoundToFloat(DifferenceFromLastFrame.Y * 100.f) / 100.f;
//DifferenceFromLastFrame.Z = FMath::RoundToFloat(DifferenceFromLastFrame.Z * 100.f) / 100.f;
DifferenceFromLastFrame.X = FMath::RoundToFloat(DifferenceFromLastFrame.X * 100.f) / 100.f;
DifferenceFromLastFrame.Y = FMath::RoundToFloat(DifferenceFromLastFrame.Y * 100.f) / 100.f;
DifferenceFromLastFrame.Z = FMath::RoundToFloat(DifferenceFromLastFrame.Z * 100.f) / 100.f;
//DifferenceFromLastFrame.Z = 0.0f; // Reset Z to zero, its not used anyway and this lets me reuse the Z component for capsule half height
}
else
@ -657,13 +648,9 @@ void UVRRootComponent::TickComponent(float DeltaTime, enum ELevelTick TickType,
{
// I'm limiting it to a -100 - 100 unit range in case people somehow skip tracking so far that this multiplication
// Would overflow the max/min values of a float. It shouldn't ever be harmful as that is a loooot of travel in one tick
DifferenceFromLastFrame.X = FMath::Clamp(DifferenceFromLastFrame.X, -100.0f, 100.0f);
DifferenceFromLastFrame.Y = FMath::Clamp(DifferenceFromLastFrame.Y, -100.0f, 100.0f);
DifferenceFromLastFrame.Z = FMath::Clamp(DifferenceFromLastFrame.Z, -100.0f, 100.0f);
UE::Net::QuantizeVector(10000, DifferenceFromLastFrame);
//DifferenceFromLastFrame.X = FMath::RoundToFloat(FMath::Clamp(DifferenceFromLastFrame.X, -100.0f, 100.0f) * 10000.f) / 10000.f;
//DifferenceFromLastFrame.Y = FMath::RoundToFloat(FMath::Clamp(DifferenceFromLastFrame.Y, -100.0f, 100.0f) * 10000.f) / 10000.f;
//DifferenceFromLastFrame.Z = FMath::RoundToFloat(FMath::Clamp(DifferenceFromLastFrame.Z, -100.0f, 100.0f) * 10000.f) / 10000.f;
DifferenceFromLastFrame.X = FMath::RoundToFloat(FMath::Clamp(DifferenceFromLastFrame.X, -100.0f, 100.0f) * 10000.f) / 10000.f;
DifferenceFromLastFrame.Y = FMath::RoundToFloat(FMath::Clamp(DifferenceFromLastFrame.Y, -100.0f, 100.0f) * 10000.f) / 10000.f;
DifferenceFromLastFrame.Z = FMath::RoundToFloat(FMath::Clamp(DifferenceFromLastFrame.Z, -100.0f, 100.0f) * 10000.f) / 10000.f;
//DifferenceFromLastFrame.Z = 0.0f; // Reset Z to zero, its not used anyway and this lets me reuse the Z component for capsule half height
}
}
@ -1073,7 +1060,7 @@ bool UVRRootComponent::MoveComponentImpl(const FVector& Delta, const FQuat& NewR
if (TestHit.bBlockingHit)
{
if (!ShouldIgnoreHitResult(MyWorld, bAllowSimulatingCollision, TestHit, Delta, Actor, MoveFlags) && !ShouldComponentIgnoreHitResult(TestHit, MoveFlags))
if (!ShouldIgnoreHitResult(MyWorld, bAllowSimulatingCollision, TestHit, Delta, Actor, MoveFlags))
{
if (TestHit.bStartPenetrating)
{
@ -1149,7 +1136,8 @@ bool UVRRootComponent::MoveComponentImpl(const FVector& Delta, const FQuat& NewR
// Remove any pending overlaps after this point, we are not going as far as we swept.
if (FirstNonInitialOverlapIdx != INDEX_NONE)
{
PendingOverlaps.SetNum(FirstNonInitialOverlapIdx, EAllowShrinking::No);
const bool bAllowShrinking = false;
PendingOverlaps.SetNum(FirstNonInitialOverlapIdx, bAllowShrinking);
}
}
}
@ -1388,13 +1376,14 @@ bool UVRRootComponent::UpdateOverlapsImpl(const TOverlapArrayView* NewPendingOve
for (int32 CompIdx = 0; CompIdx < OldOverlappingComponentPtrs.Num() && NewOverlappingComponentPtrs.Num() > 0; ++CompIdx)
{
// RemoveAtSwap is ok, since it is not necessary to maintain order
const bool bAllowShrinking = false;
const FOverlapInfo* SearchItem = OldOverlappingComponentPtrs[CompIdx];
const int32 NewElementIdx = IndexOfOverlapFast(NewOverlappingComponentPtrs, SearchItem);
if (NewElementIdx != INDEX_NONE)
{
NewOverlappingComponentPtrs.RemoveAtSwap(NewElementIdx, 1, EAllowShrinking::No);
OldOverlappingComponentPtrs.RemoveAtSwap(CompIdx, 1, EAllowShrinking::No);
NewOverlappingComponentPtrs.RemoveAtSwap(NewElementIdx, 1, bAllowShrinking);
OldOverlappingComponentPtrs.RemoveAtSwap(CompIdx, 1, bAllowShrinking);
--CompIdx;
}
}
@ -1424,7 +1413,7 @@ bool UVRRootComponent::UpdateOverlapsImpl(const TOverlapArrayView* NewPendingOve
const int32 StaleElementIndex = IndexOfOverlapFast(OverlappingComponents, OtherOverlap);
if (StaleElementIndex != INDEX_NONE)
{
OverlappingComponents.RemoveAtSwap(StaleElementIndex, 1, bAllowShrinking ? EAllowShrinking::Yes : EAllowShrinking::No);
OverlappingComponents.RemoveAtSwap(StaleElementIndex, 1, bAllowShrinking);
}
}
}
@ -1526,7 +1515,7 @@ bool UVRRootComponent::IsLocallyControlled() const
{
if (GetNetMode() < ENetMode::NM_Client)
{
if (owningVRChar->GetVRReplicateCapsuleHeight())
if (owningVRChar->VRReplicateCapsuleHeight)
{
owningVRChar->ReplicatedCapsuleHeight.CapsuleHeight = CapsuleHalfHeight;
}
@ -1660,7 +1649,7 @@ bool UVRRootComponent::ConvertSweptOverlapsToCurrentOverlapsVR(
// Not handled yet. We could do it by checking every body explicitly and track each body index in the overlap test, but this seems like a rare need.
return false;
}
else if (Cast<USkeletalMeshComponent>(OtherPrimitive) /* || Cast<USkeletalMeshComponent>(this)*/)
else if (Cast<USkeletalMeshComponent>(OtherPrimitive) || Cast<USkeletalMeshComponent>(this))
{
// SkeletalMeshComponent does not support this operation, and would return false in the test when an actual query could return true.
return false;

View file

@ -17,7 +17,6 @@
#include "IStereoLayers.h"
#include "IHeadMountedDisplay.h"
#include "PrimitiveViewRelevance.h"
#include "StereoLayerAdditionalFlagsManager.h"
#include "PrimitiveSceneProxy.h"
#include "UObject/ConstructorHelpers.h"
#include "EngineGlobals.h"
@ -385,9 +384,9 @@ UVRStereoWidgetComponent::UVRStereoWidgetComponent(const FObjectInitializer& Obj
//, StereoLayerType(SLT_TrackerLocked)
//, StereoLayerShape(SLSH_QuadLayer)
, Priority(0)
, LayerId(IStereoLayers::FLayerDesc::INVALID_LAYER_ID)
, bIsDirty(true)
, bTextureNeedsUpdate(false)
, LayerId(IStereoLayers::FLayerDesc::INVALID_LAYER_ID)
, LastTransform(FTransform::Identity)
, bLastVisible(false)
{
@ -412,16 +411,6 @@ UVRStereoWidgetComponent::~UVRStereoWidgetComponent()
{
}
void UVRStereoWidgetComponent::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
if (EndPlayReason == EEndPlayReason::EndPlayInEditor || EndPlayReason == EEndPlayReason::Quit)
{
//FStereoLayerAdditionalFlagsManager::Destroy();
}
}
void UVRStereoWidgetComponent::BeginDestroy()
{
IStereoLayers* StereoLayers;
@ -726,13 +715,6 @@ void UVRStereoWidgetComponent::TickComponent(float DeltaTime, enum ELevelTick Ti
LayerDsec.Flags |= (bSupportsDepth) ? IStereoLayers::LAYER_FLAG_SUPPORT_DEPTH : 0;
LayerDsec.Flags |= (!bCurrVisible) ? IStereoLayers::LAYER_FLAG_HIDDEN : 0;
// Would love to implement but they aren't exporting the symbols
/*TSharedPtr<FStereoLayerAdditionalFlagsManager> FlagsManager = FStereoLayerAdditionalFlagsManager::Get();
for (FName& Flag : AdditionalFlags)
{
LayerDsec.Flags |= FlagsManager->GetFlagValue(Flag);
}*/
// Fix this later when WorldLocked is no longer wrong.
switch (Space)
{
@ -1111,7 +1093,7 @@ public:
bShadowMapped = false;
}
virtual void OnTransformChanged(FRHICommandListBase& RHICmdList) override
virtual void OnTransformChanged() override
{
Origin = GetLocalToWorld().GetOrigin();
}

View file

@ -316,10 +316,6 @@ public:
~UGripMotionControllerComponent();
// TMP until physics velocity bug is fixed #TODO: Remove
void CalculateGripVelocity(FBPActorGripInformation &GripToFill, UPrimitiveComponent* ComponentToSample, float DeltaTime);
// Custom version of the component sweep function to remove that aggravating warning epic is throwing about skeletal mesh components.
void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
virtual void InitializeComponent() override;
@ -498,17 +494,10 @@ public:
UPROPERTY(BlueprintReadOnly, Replicated, Category = "GripMotionController", ReplicatedUsing = OnRep_GrippedObjects)
TArray<FBPActorGripInformation> GrippedObjects;
// If modifying members in gripped objects directly or a specific grip you need to call this function if you are using Push Networking
void DIRTY_GRIPPED_OBJECTS();
// When possible I suggest that you use GetAllGrips/GetGrippedObjects instead of directly referencing this
UPROPERTY(BlueprintReadOnly, Replicated, Category = "GripMotionController", ReplicatedUsing = OnRep_LocallyGrippedObjects)
TArray<FBPActorGripInformation> LocallyGrippedObjects;
// If modifying members in locally gripped objects directly or a specific grip you need to call this function if you are using Push Networking
void DIRTY_LOCALLY_GRIPPED_OBJECTS();
// Local Grip TransactionalBuffer to store server sided grips that need to be emplaced into the local buffer
UPROPERTY(BlueprintReadOnly, Replicated, Category = "GripMotionController", ReplicatedUsing = OnRep_LocalTransaction)
TArray<FBPActorGripInformation> LocalTransactionBuffer;
@ -777,8 +766,37 @@ public:
return true;
}
// Check the local transaction buffer
void CheckTransactionBuffer();
inline void CheckTransactionBuffer()
{
if (LocalTransactionBuffer.Num())
{
for (int i = LocalTransactionBuffer.Num() - 1; i >= 0; --i)
{
if (LocalTransactionBuffer[i].ValueCache.bWasInitiallyRepped && LocalTransactionBuffer[i].GripID != LocalTransactionBuffer[i].ValueCache.CachedGripID)
{
// There appears to be a bug with TArray replication where if you replace an index with another value of that
// Index, it doesn't fully re-init the object, this is a workaround to re-zero non replicated variables
// when that happens.
LocalTransactionBuffer[i].ClearNonReppingItems();
}
if (!LocalTransactionBuffer[i].ValueCache.bWasInitiallyRepped && LocalTransactionBuffer[i].GrippedObject->IsValidLowLevelFast())
{
LocalTransactionBuffer[i].ValueCache.bWasInitiallyRepped = true;
LocalTransactionBuffer[i].ValueCache.CachedGripID = LocalTransactionBuffer[i].GripID;
int32 Index = LocallyGrippedObjects.Add(LocalTransactionBuffer[i]);
if (Index != INDEX_NONE)
{
NotifyGrip(LocallyGrippedObjects[Index]);
}
Server_NotifyHandledTransaction(LocalTransactionBuffer[i].GripID);
}
}
}
}
UFUNCTION()
virtual void OnRep_LocalTransaction(TArray<FBPActorGripInformation> OriginalArrayState) // Original array state is useless without full serialize, it just hold last delta
@ -830,29 +848,18 @@ public:
// Run the smoothing step
void RunNetworkedSmoothing(float DeltaTime);
protected:
// Rate to update the position to the server, 100htz is default (same as replication rate, should also hit every tick).
// On dedicated servers the update rate should be at or lower than the server tick rate for smoothing to work
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "GripMotionController|Networking", meta = (ClampMin = "0", UIMin = "0"))
float ControllerNetUpdateRate;
public:
void SetControllerNetUpdateRate(float NewControllerNetUpdateRate);
inline float GetControllerNetUpdateRate() { return ControllerNetUpdateRate; };
// Used in Tick() to accumulate before sending updates, didn't want to use a timer in this case, also used for remotes to lerp position
float ControllerNetUpdateCount;
protected:
// Whether to smooth (lerp) between ticks for the replicated motion, DOES NOTHING if update rate is larger than FPS!
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "GripMotionController|Networking")
bool bSmoothReplicatedMotion;
public:
void SetSmoothReplicatedMotion(bool NewSmoothReplicatedMotion);
inline bool GetSmoothReplicatedMotion() { return bSmoothReplicatedMotion; };
// If true then we will use exponential smoothing with buffered correction
UPROPERTY(EditAnywhere, Category = "GripMotionController|Networking|Smoothing", meta = (editcondition = "bSmoothReplicatedMotion"))
bool bUseExponentialSmoothing = true;
@ -869,16 +876,10 @@ public:
UPROPERTY(EditAnywhere, Category = "GripMotionController|Networking|Smoothing", meta = (editcondition = "bUseExponentialSmoothing"))
float NetworkNoSmoothUpdateDistance = 100.f;
protected:
// Whether to replicate even if no tracking (FPS or test characters)
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "GripMotionController|Networking")
bool bReplicateWithoutTracking;
public:
void SetReplicateWithoutTracking(bool NewReplicateWithoutTracking);
inline bool GetReplicateWithoutTracking() { return bReplicateWithoutTracking; };
// I'm sending it unreliable because it is being resent pretty often
UFUNCTION(Unreliable, Server, WithValidation)
void Server_SendControllerTransform(FBPVRComponentPosRep NewTransform);

View file

@ -181,8 +181,11 @@ public:
virtual void OnLodgeHitCallback(AActor* SelfActor, AActor* OtherActor, FVector NormalImpulse, const FHitResult& Hit);
UFUNCTION(BlueprintCallable, Category = "Weapon Settings")
void SetIsLodged(bool IsLodged, UPrimitiveComponent* LodgeComponent);
void SetIsLodged(bool IsLodged, UPrimitiveComponent * LodgeComponent)
{
bIsLodged = IsLodged;
LodgedComponent = LodgeComponent;
}
bool bIsLodged;
TWeakObjectPtr<UPrimitiveComponent> LodgedComponent;

View file

@ -38,22 +38,14 @@ public:
virtual void GatherCurrentMovement() override;
protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadOnly, Instanced, Category = "VRGripInterface")
TArray<TObjectPtr<UVRGripScriptBase>> GripLogicScripts;
// If true then the grip script array will be considered for replication, if false then it will not
// This is an optimization for when you have a lot of grip scripts in use, you can toggle this off in cases
// where the object will never have a replicating script
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
bool bReplicateGripScripts;
public:
void SetReplicateGripScripts(bool NewReplicateGripScripts);
inline bool GetReplicateGripScripts() { return bReplicateGripScripts; };
// Get the grip script array, will automatically dirty it if they are replicated as it is assumed if you are directly accessing it you are altering it
TArray<TObjectPtr<UVRGripScriptBase>>& GetGripLogicScripts();
bool ReplicateSubobjects(UActorChannel* Channel, class FOutBunch *Bunch, FReplicationFlags *RepFlags) override;
virtual void GetSubobjectsWithStableNamesForNetworking(TArray<UObject*>& ObjList) override;
@ -86,16 +78,8 @@ public:
// Client Auth Throwing Data and functions
// ------------------------------------------------
protected:
// Replication settings for client auth throwing
// Must call MarkClientAuthReplicationDirty if setting the properties of it live
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "Replication")
FVRClientAuthReplicationData ClientAuthReplicationData;
public:
// If changing this in c++ it is using a getter to make sure it is dirtied
FVRClientAuthReplicationData& GetClientAuthReplicationData(FVRClientAuthReplicationData& ClientAuthData);
// Add this to client side physics replication (until coming to rest or timeout period is hit)
UFUNCTION(BlueprintCallable, Category = "Networking")
@ -138,28 +122,17 @@ public:
TagContainer = GameplayTags;
}
protected:
/** Tags that are set on this object */
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "GameplayTags")
FGameplayTagContainer GameplayTags;
public:
FGameplayTagContainer& GetGameplayTags();
FGameplayTagContainer GameplayTags;
// End Gameplay Tag Interface
virtual void PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker) override;
protected:
// Skips the attachment replication if we are locally owned and our grip settings say that we are a client authed grip.
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "Replication")
bool bAllowIgnoringAttachOnOwner;
public:
void SetAllowIgnoringAttachOnOwner(bool bNewAllowIgnoringAttachOnOwner);
inline bool GetAllowIgnoringAttachOnOwner() { return bAllowIgnoringAttachOnOwner; };
// Should we skip attachment replication (vr settings say we are a client auth grip and our owner is locally controlled)
/*inline*/ bool ShouldWeSkipAttachmentReplication(bool bConsiderHeld = true) const;
@ -188,21 +161,11 @@ public:
// On Destroy clean up our objects
virtual void BeginDestroy() override;
protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
bool bRepGripSettingsAndGameplayTags;
public:
void SetRepGripSettingsAndGameplayTags(bool bNewRepGripSettingsAndGameplayTags);
inline bool GetRepGripSettingsAndGameplayTags() { return bRepGripSettingsAndGameplayTags; };
protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
FBPInterfaceProperties VRGripInterfaceSettings;
public:
// Get VRGripInterfaceSettings, set MarkDirty if you intend to (or may) modify the values inside of it
FBPInterfaceProperties& GetVRGripInterfaceSettings(bool bMarkDirty);
// Set up as deny instead of allow so that default allows for gripping
// The GripInitiator is not guaranteed to be valid, check it for validity

View file

@ -31,7 +31,6 @@ public:
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadOnly, Instanced, Category = "VRGripInterface")
TArray<TObjectPtr<UVRGripScriptBase>> GripLogicScripts;
@ -40,13 +39,6 @@ protected:
// where the object will never have a replicating script
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
bool bReplicateGripScripts;
public:
void SetReplicateGripScripts(bool NewReplicateGripScripts);
inline bool GetReplicateGripScripts() { return bReplicateGripScripts; };
// Get the grip script array, will automatically dirty it if they are replicated as it is assumed if you are directly accessing it you are altering it
TArray<TObjectPtr<UVRGripScriptBase>>& GetGripLogicScripts();
bool ReplicateSubobjects(UActorChannel* Channel, class FOutBunch *Bunch, FReplicationFlags *RepFlags) override;
@ -84,14 +76,10 @@ public:
TagContainer = GameplayTags;
}
protected:
/** Tags that are set on this object */
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "GameplayTags")
FGameplayTagContainer GameplayTags;
public:
FGameplayTagContainer& GetGameplayTags();
// End Gameplay Tag Interface
virtual void PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker) override;
@ -106,7 +94,6 @@ public:
// This one is for components to clean up
virtual void OnComponentDestroyed(bool bDestroyingHierarchy) override;
protected:
// Requires bReplicates to be true for the component
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface|Replication")
bool bRepGripSettingsAndGameplayTags;
@ -119,16 +106,6 @@ protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
FBPInterfaceProperties VRGripInterfaceSettings;
public:
void SetRepGripSettingsAndGameplayTags(bool bNewRepGripSettingsAndGameplayTags);
inline bool GetRepGripSettingsAndGameplayTags() { return bRepGripSettingsAndGameplayTags; };
// Get VRGripInterfaceSettings, set MarkDirty if you intend to (or may) modify the values inside of it
FBPInterfaceProperties& GetVRGripInterfaceSettings(bool bMarkDirty);
void SetReplicateMovement(bool bNewReplicateMovement);
inline bool GetReplicateMovement() { return bReplicateMovement; };
// Set up as deny instead of allow so that default allows for gripping
// The GripInitiator is not guaranteed to be valid, check it for validity

View file

@ -31,7 +31,6 @@ public:
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadOnly, Instanced, Category = "VRGripInterface")
TArray<TObjectPtr<UVRGripScriptBase>> GripLogicScripts;
@ -41,14 +40,6 @@ protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
bool bReplicateGripScripts;
public:
void SetReplicateGripScripts(bool NewReplicateGripScripts);
inline bool GetReplicateGripScripts() { return bReplicateGripScripts; };
// Get the grip script array, will automatically dirty it if they are replicated as it is assumed if you are directly accessing it you are altering it
TArray<TObjectPtr<UVRGripScriptBase>>& GetGripLogicScripts();
bool ReplicateSubobjects(UActorChannel* Channel, class FOutBunch *Bunch, FReplicationFlags *RepFlags) override;
// Sets the Deny Gripping variable on the FBPInterfaceSettings struct
@ -84,12 +75,9 @@ public:
TagContainer = GameplayTags;
}
protected:
/** Tags that are set on this object */
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "GameplayTags")
FGameplayTagContainer GameplayTags;
public:
FGameplayTagContainer& GetGameplayTags();
// End Gameplay Tag Interface
@ -104,8 +92,6 @@ public:
// This one is for components to clean up
virtual void OnComponentDestroyed(bool bDestroyingHierarchy) override;
protected:
// Requires bReplicates to be true for the component
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface|Replication")
bool bRepGripSettingsAndGameplayTags;
@ -119,17 +105,6 @@ protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
FBPInterfaceProperties VRGripInterfaceSettings;
public:
void SetRepGripSettingsAndGameplayTags(bool bNewRepGripSettingsAndGameplayTags);
inline bool GetRepGripSettingsAndGameplayTags() { return bRepGripSettingsAndGameplayTags; };
// Get VRGripInterfaceSettings, set MarkDirty if you intend to (or may) modify the values inside of it
FBPInterfaceProperties& GetVRGripInterfaceSettings(bool bMarkDirty);
void SetReplicateMovement(bool bNewReplicateMovement);
inline bool GetReplicateMovement() { return bReplicateMovement; };
// Set up as deny instead of allow so that default allows for gripping
// The GripInitiator is not guaranteed to be valid, check it for validity
virtual bool DenyGripping_Implementation(UGripMotionControllerComponent * GripInitiator = nullptr) override;

View file

@ -10,9 +10,9 @@
#include "PhysicsReplicationInterface.h"
#include "Physics/PhysicsInterfaceDeclares.h"
#include "PhysicsProxy/SingleParticlePhysicsProxyFwd.h"
#include "Chaos/Particles.h"
#include "Chaos/PhysicsObject.h"
#include "Chaos/SimCallbackObject.h"
#include "Physics/NetworkPhysicsSettingsComponent.h"
#include "GrippablePhysicsReplication.generated.h"
@ -33,18 +33,13 @@
//struct FAsyncPhysicsRepCallbackDataVR;
//class FPhysicsReplicationAsyncCallbackVR;
#pragma region FPhysicsReplicationAsync
class FPhysicsReplicationAsyncVR : public Chaos::TSimCallbackObject<
FPhysicsReplicationAsyncInput,
Chaos::FSimCallbackNoOutput,
Chaos::ESimCallbackOptions::Presimulate | Chaos::ESimCallbackOptions::PhysicsObjectUnregister>
Chaos::ESimCallbackOptions::Presimulate>
{
virtual FName GetFNameForStatId() const override;
virtual void OnPostInitialize_Internal() override;
virtual void OnPreSimulate_Internal() override;
virtual void OnPhysicsObjectUnregistered_Internal(Chaos::FConstPhysicsObjectHandle PhysicsObject) override;
virtual void ApplyTargetStatesAsync(const float DeltaSeconds, const FPhysicsRepErrorCorrectionData& ErrorCorrection, const TArray<FPhysicsRepAsyncInputData>& TargetStates);
// Replication functions
@ -53,25 +48,14 @@ class FPhysicsReplicationAsyncVR : public Chaos::TSimCallbackObject<
virtual bool PredictiveInterpolation(Chaos::FPBDRigidParticleHandle* Handle, FReplicatedPhysicsTargetAsync& Target, const float DeltaSeconds);
virtual bool ResimulationReplication(Chaos::FPBDRigidParticleHandle* Handle, FReplicatedPhysicsTargetAsync& Target, const float DeltaSeconds);
public:
virtual void RegisterSettings(Chaos::FConstPhysicsObjectHandle PhysicsObject, FNetworkPhysicsSettingsAsync InSettings);
private:
float LatencyOneWay;
FRigidBodyErrorCorrection ErrorCorrectionDefault;
FNetworkPhysicsSettingsAsync SettingsCurrent;
FNetworkPhysicsSettingsAsync SettingsDefault;
TMap<Chaos::FConstPhysicsObjectHandle, FReplicatedPhysicsTargetAsync> ObjectToTarget;
TMap<Chaos::FConstPhysicsObjectHandle, FNetworkPhysicsSettingsAsync> ObjectToSettings;
TArray<int32> ParticlesInResimIslands;
TMap<Chaos::FPhysicsObject*, FReplicatedPhysicsTargetAsync> ObjectToTarget;
private:
void UpdateAsyncTarget(const FPhysicsRepAsyncInputData& Input, Chaos::FPBDRigidsSolver* RigidsSolver);
void UpdateAsyncTarget(const FPhysicsRepAsyncInputData& Input);
void UpdateRewindDataTarget(const FPhysicsRepAsyncInputData& Input);
void CacheResimInteractions();
// Sets SettingsCurrent to either the objects custom settings or to the default settings
void FetchObjectSettings(Chaos::FConstPhysicsObjectHandle PhysicsObject);
static void ExtrapolateTarget(FReplicatedPhysicsTargetAsync& Target, const int32 ExtrapolateFrames, const float DeltaSeconds);
public:
void Setup(FRigidBodyErrorCorrection ErrorCorrection)
@ -80,7 +64,7 @@ public:
}
};
#pragma endregion // FPhysicsReplicationAsync
class FPhysicsReplicationVR : public FPhysicsReplication
{
@ -97,10 +81,8 @@ public:
virtual bool ApplyRigidBodyState(float DeltaSeconds, FBodyInstance* BI, FReplicatedPhysicsTarget& PhysicsTarget, const FRigidBodyErrorCorrection& ErrorCorrection, const float PingSecondsOneWay, int32 LocalFrame, int32 NumPredictedFrames) override;
virtual bool ApplyRigidBodyState(float DeltaSeconds, FBodyInstance* BI, FReplicatedPhysicsTarget& PhysicsTarget, const FRigidBodyErrorCorrection& ErrorCorrection, const float PingSecondsOneWay, bool* bDidHardSnap = nullptr) override;
void SetReplicatedTargetVR(Chaos::FConstPhysicsObjectHandle PhysicsObject, const FRigidBodyState& ReplicatedTarget, int32 ServerFrame, EPhysicsReplicationMode ReplicationMode = EPhysicsReplicationMode::Default);
virtual void RemoveReplicatedTarget(UPrimitiveComponent* Component) override;
virtual void SetReplicatedTarget(UPrimitiveComponent* Component, FName BoneName, const FRigidBodyState& ReplicatedTarget, int32 ServerFrame) override;
void SetReplicatedTargetVR(Chaos::FPhysicsObject* PhysicsObject, const FRigidBodyState& ReplicatedTarget, int32 ServerFrame, EPhysicsReplicationMode ReplicationMode);
TArray<FReplicatedPhysicsTarget> ReplicatedTargetsQueueVR;
FPhysicsReplicationAsyncVR* PhysicsReplicationAsyncVR;
@ -109,7 +91,6 @@ public:
void PrepareAsyncData_ExternalVR(const FRigidBodyErrorCorrection& ErrorCorrection); //prepare async data for writing. Call on external thread (i.e. game thread)
};
class IPhysicsReplicationFactoryVR : public IPhysicsReplicationFactory
{
public:

View file

@ -30,13 +30,11 @@ class VREXPANSIONPLUGIN_API UOptionalRepSkeletalMeshComponent : public USkeletal
public:
UOptionalRepSkeletalMeshComponent(const FObjectInitializer& ObjectInitializer);
protected:
public:
// Overrides the default of : true and allows for controlling it like in an actor, should be default of off normally with grippable components
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "Component Replication")
bool bReplicateMovement;
public:
bool GetReplicateMovement() { return bReplicateMovement; }
void SetReplicateMovement(bool bNewReplicateMovement);
virtual void PreReplication(IRepChangedPropertyTracker& ChangedPropertyTracker) override;
@ -66,7 +64,6 @@ public:
virtual void GatherCurrentMovement() override;
protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadOnly, Instanced, Category = "VRGripInterface")
TArray<TObjectPtr<UVRGripScriptBase>> GripLogicScripts;
@ -75,13 +72,6 @@ protected:
// where the object will never have a replicating script
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
bool bReplicateGripScripts;
public:
void SetReplicateGripScripts(bool NewReplicateGripScripts);
inline bool GetReplicateGripScripts() { return bReplicateGripScripts; };
// Get the grip script array, will automatically dirty it if they are replicated as it is assumed if you are directly accessing it you are altering it
TArray<TObjectPtr<UVRGripScriptBase>>& GetGripLogicScripts();
bool ReplicateSubobjects(UActorChannel* Channel, class FOutBunch* Bunch, FReplicationFlags* RepFlags) override;
virtual void GetSubobjectsWithStableNamesForNetworking(TArray<UObject*>& ObjList) override;
@ -114,12 +104,8 @@ public:
// Client Auth Throwing Data and functions
// ------------------------------------------------
protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "Replication")
FVRClientAuthReplicationData ClientAuthReplicationData;
public:
// If changing this in c++ it is using a getter to make sure it is dirtied
FVRClientAuthReplicationData& GetClientAuthReplicationData(FVRClientAuthReplicationData& ClientAuthData);
// Add this to client side physics replication (until coming to rest or timeout period is hit)
UFUNCTION(BlueprintCallable, Category = "Networking")
@ -162,29 +148,18 @@ public:
TagContainer = GameplayTags;
}
protected:
/** Tags that are set on this object */
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "GameplayTags")
FGameplayTagContainer GameplayTags;
public:
FGameplayTagContainer& GetGameplayTags();
FGameplayTagContainer GameplayTags;
// End Gameplay Tag Interface
virtual void PreReplication(IRepChangedPropertyTracker& ChangedPropertyTracker) override;
protected:
// Skips the attachment replication if we are locally owned and our grip settings say that we are a client authed grip.
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "Replication")
bool bAllowIgnoringAttachOnOwner;
public:
void SetAllowIgnoringAttachOnOwner(bool bNewAllowIgnoringAttachOnOwner);
inline bool GetAllowIgnoringAttachOnOwner() { return bAllowIgnoringAttachOnOwner; };
// Should we skip attachment replication (vr settings say we are a client auth grip and our owner is locally controlled)
/*inline*/ bool ShouldWeSkipAttachmentReplication(bool bConsiderHeld = true) const;
@ -212,22 +187,12 @@ public:
// On Destroy clean up our objects
virtual void BeginDestroy() override;
protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
bool bRepGripSettingsAndGameplayTags;
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
FBPInterfaceProperties VRGripInterfaceSettings;
public:
void SetRepGripSettingsAndGameplayTags(bool bNewRepGripSettingsAndGameplayTags);
inline bool GetRepGripSettingsAndGameplayTags() { return bRepGripSettingsAndGameplayTags; };
// Get VRGripInterfaceSettings, set MarkDirty if you intend to (or may) modify the values inside of it
FBPInterfaceProperties& GetVRGripInterfaceSettings(bool bMarkDirty);
// Set up as deny instead of allow so that default allows for gripping
// The GripInitiator is not guaranteed to be valid, check it for validity
virtual bool DenyGripping_Implementation(UGripMotionControllerComponent * GripInitiator = nullptr) override;

View file

@ -35,7 +35,6 @@ public:
virtual void GetWeldedBodies(TArray<FBodyInstance*>& OutWeldedBodies, TArray<FName>& OutLabels, bool bIncludingAutoWeld) override;
virtual FBodyInstance* GetBodyInstance(FName BoneName = NAME_None, bool bGetWelded = true, int32 Index = INDEX_NONE) const override;
protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadOnly, Instanced, Category = "VRGripInterface")
TArray<TObjectPtr<UVRGripScriptBase>> GripLogicScripts;
@ -44,12 +43,6 @@ protected:
// where the object will never have a replicating script
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
bool bReplicateGripScripts;
public:
void SetReplicateGripScripts(bool NewReplicateGripScripts);
inline bool GetReplicateGripScripts() { return bReplicateGripScripts; };
// Get the grip script array, will automatically dirty it if they are replicated as it is assumed if you are directly accessing it you are altering it
TArray<TObjectPtr<UVRGripScriptBase>>& GetGripLogicScripts();
bool ReplicateSubobjects(UActorChannel* Channel, class FOutBunch *Bunch, FReplicationFlags *RepFlags) override;
@ -88,15 +81,10 @@ public:
TagContainer = GameplayTags;
}
protected:
/** Tags that are set on this object */
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "GameplayTags")
FGameplayTagContainer GameplayTags;
public:
FGameplayTagContainer& GetGameplayTags();
// End Gameplay Tag Interface
virtual void PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker) override;
@ -110,7 +98,6 @@ public:
// This one is for components to clean up
virtual void OnComponentDestroyed(bool bDestroyingHierarchy) override;
protected:
// Requires bReplicates to be true for the component
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface|Replication")
bool bRepGripSettingsAndGameplayTags;
@ -123,16 +110,6 @@ protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
FBPInterfaceProperties VRGripInterfaceSettings;
public:
void SetRepGripSettingsAndGameplayTags(bool bNewRepGripSettingsAndGameplayTags);
inline bool GetRepGripSettingsAndGameplayTags() { return bRepGripSettingsAndGameplayTags; };
// Get VRGripInterfaceSettings, set MarkDirty if you intend to (or may) modify the values inside of it
FBPInterfaceProperties& GetVRGripInterfaceSettings(bool bMarkDirty);
void SetReplicateMovement(bool bNewReplicateMovement);
inline bool GetReplicateMovement() { return bReplicateMovement; };
// Set up as deny instead of allow so that default allows for gripping
// The GripInitiator is not guaranteed to be valid, check it for validity

View file

@ -31,7 +31,6 @@ public:
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadOnly, Instanced, Category = "VRGripInterface")
TArray<TObjectPtr<UVRGripScriptBase>> GripLogicScripts;
@ -40,13 +39,6 @@ protected:
// where the object will never have a replicating script
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
bool bReplicateGripScripts;
public:
void SetReplicateGripScripts(bool NewReplicateGripScripts);
inline bool GetReplicateGripScripts() { return bReplicateGripScripts; };
// Get the grip script array, will automatically dirty it if they are replicated as it is assumed if you are directly accessing it you are altering it
TArray<TObjectPtr<UVRGripScriptBase>>& GetGripLogicScripts();
bool ReplicateSubobjects(UActorChannel* Channel, class FOutBunch *Bunch, FReplicationFlags *RepFlags) override;
@ -85,12 +77,9 @@ public:
TagContainer = GameplayTags;
}
protected:
/** Tags that are set on this object */
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "GameplayTags")
FGameplayTagContainer GameplayTags;
public:
FGameplayTagContainer& GetGameplayTags();
// End Gameplay Tag Interface
@ -105,7 +94,6 @@ public:
// This one is for components to clean up
virtual void OnComponentDestroyed(bool bDestroyingHierarchy) override;
protected:
// Requires bReplicates to be true for the component
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface|Replication")
bool bRepGripSettingsAndGameplayTags;
@ -118,16 +106,6 @@ protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
FBPInterfaceProperties VRGripInterfaceSettings;
public:
void SetRepGripSettingsAndGameplayTags(bool bNewRepGripSettingsAndGameplayTags);
inline bool GetRepGripSettingsAndGameplayTags() { return bRepGripSettingsAndGameplayTags; };
// Get VRGripInterfaceSettings, set MarkDirty if you intend to (or may) modify the values inside of it
FBPInterfaceProperties& GetVRGripInterfaceSettings(bool bMarkDirty);
void SetReplicateMovement(bool bNewReplicateMovement);
inline bool GetReplicateMovement() { return bReplicateMovement; };
// Set up as deny instead of allow so that default allows for gripping
// The GripInitiator is not guaranteed to be valid, check it for validity

View file

@ -60,8 +60,6 @@ public:
virtual void GatherCurrentMovement() override;
protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadOnly, Instanced, Category = "VRGripInterface")
TArray<TObjectPtr<UVRGripScriptBase>> GripLogicScripts;
@ -71,14 +69,6 @@ protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
bool bReplicateGripScripts;
public:
void SetReplicateGripScripts(bool NewReplicateGripScripts);
inline bool GetReplicateGripScripts() { return bReplicateGripScripts; };
// Get the grip script array, will automatically dirty it if they are replicated as it is assumed if you are directly accessing it you are altering it
TArray<TObjectPtr<UVRGripScriptBase>>& GetGripLogicScripts();
bool ReplicateSubobjects(UActorChannel* Channel, class FOutBunch *Bunch, FReplicationFlags *RepFlags) override;
virtual void GetSubobjectsWithStableNamesForNetworking(TArray<UObject*>& ObjList) override;
@ -111,15 +101,9 @@ public:
// Client Auth Throwing Data and functions
// ------------------------------------------------
protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "Replication")
FVRClientAuthReplicationData ClientAuthReplicationData;
public:
// If changing this in c++ it is using a getter to make sure it is dirtied
FVRClientAuthReplicationData& GetClientAuthReplicationData(FVRClientAuthReplicationData& ClientAuthData);
// Add this to client side physics replication (until coming to rest or timeout period is hit)
UFUNCTION(BlueprintCallable, Category = "Networking")
bool AddToClientReplicationBucket();
@ -163,27 +147,18 @@ public:
TagContainer = GameplayTags;
}
protected:
/** Tags that are set on this object */
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "GameplayTags")
FGameplayTagContainer GameplayTags;
public:
FGameplayTagContainer& GetGameplayTags();
// End Gameplay Tag Interface
virtual void PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker) override;
protected:
// Skips the attachment replication if we are locally owned and our grip settings say that we are a client authed grip.
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "Replication")
bool bAllowIgnoringAttachOnOwner;
public:
void SetAllowIgnoringAttachOnOwner(bool bNewAllowIgnoringAttachOnOwner);
inline bool GetAllowIgnoringAttachOnOwner() { return bAllowIgnoringAttachOnOwner; };
// Should we skip attachment replication (vr settings say we are a client auth grip and our owner is locally controlled)
/*inline*/ bool ShouldWeSkipAttachmentReplication(bool bConsiderHeld = true) const;
@ -211,22 +186,12 @@ public:
// On Destroy clean up our objects
virtual void BeginDestroy() override;
protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
bool bRepGripSettingsAndGameplayTags;
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
FBPInterfaceProperties VRGripInterfaceSettings;
public:
void SetRepGripSettingsAndGameplayTags(bool bNewRepGripSettingsAndGameplayTags);
inline bool GetRepGripSettingsAndGameplayTags() { return bRepGripSettingsAndGameplayTags; };
// Get VRGripInterfaceSettings, set MarkDirty if you intend to (or may) modify the values inside of it
FBPInterfaceProperties& GetVRGripInterfaceSettings(bool bMarkDirty);
// Set up as deny instead of allow so that default allows for gripping
// The GripInitiator is not guaranteed to be valid, check it for validity
virtual bool DenyGripping_Implementation(UGripMotionControllerComponent * GripInitiator = nullptr) override;

View file

@ -35,8 +35,6 @@ public:
// Gameplay tag interface
// ------------------------------------------------
protected:
/** Overridden to return requirements tags */
UPROPERTY(EditAnywhere, Replicated, BlueprintReadOnly, Instanced, Category = "VRGripInterface")
TArray<TObjectPtr<UVRGripScriptBase>> GripLogicScripts;
@ -47,13 +45,6 @@ protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
bool bReplicateGripScripts;
public:
void SetReplicateGripScripts(bool NewReplicateGripScripts);
inline bool GetReplicateGripScripts() { return bReplicateGripScripts; };
// Get the grip script array, will automatically dirty it if they are replicated as it is assumed if you are directly accessing it you are altering it
TArray<TObjectPtr<UVRGripScriptBase>>& GetGripLogicScripts();
bool ReplicateSubobjects(UActorChannel* Channel, class FOutBunch *Bunch, FReplicationFlags *RepFlags) override;
// Sets the Deny Gripping variable on the FBPInterfaceSettings struct
@ -85,15 +76,10 @@ public:
TagContainer = GameplayTags;
}
protected:
/** Tags that are set on this object */
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "GameplayTags")
FGameplayTagContainer GameplayTags;
public:
FGameplayTagContainer& GetGameplayTags();
// End Gameplay Tag Interface
virtual void PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker) override;
@ -107,7 +93,6 @@ public:
// This one is for components to clean up
virtual void OnComponentDestroyed(bool bDestroyingHierarchy) override;
protected:
// Requires bReplicates to be true for the component
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface|Replication")
bool bRepGripSettingsAndGameplayTags;
@ -121,16 +106,6 @@ protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
FBPInterfaceProperties VRGripInterfaceSettings;
public:
void SetRepGripSettingsAndGameplayTags(bool bNewRepGripSettingsAndGameplayTags);
inline bool GetRepGripSettingsAndGameplayTags() { return bRepGripSettingsAndGameplayTags; };
// Get VRGripInterfaceSettings, set MarkDirty if you intend to (or may) modify the values inside of it
FBPInterfaceProperties& GetVRGripInterfaceSettings(bool bMarkDirty);
void SetReplicateMovement(bool bNewReplicateMovement);
inline bool GetReplicateMovement() { return bReplicateMovement; };
// Set up as deny instead of allow so that default allows for gripping
// The GripInitiator is not guaranteed to be valid, check it for validity
virtual bool DenyGripping_Implementation(UGripMotionControllerComponent * GripInitiator = nullptr) override;

View file

@ -7,9 +7,7 @@
#include "GameplayTagAssetInterface.h"
#include "Components/SceneComponent.h"
#include "Animation/AnimInstance.h"
#include "Animation/BoneReference.h"
#include "Misc/Guid.h"
#include "HandSocketComponent.generated.h"
class USkeletalMeshComponent;
@ -411,8 +409,6 @@ public:
TagContainer = GameplayTags;
}
protected:
/** Tags that are set on this object */
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "GameplayTags")
FGameplayTagContainer GameplayTags;
@ -427,14 +423,6 @@ public:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface|Replication")
bool bReplicateMovement;
public:
FGameplayTagContainer& GetGameplayTags();
void SetRepGameplayTags(bool NewRepGameplayTags);
inline bool GetRepGameplayTags() { return bRepGameplayTags; };
void SetReplicateMovement(bool NewReplicateMovement);
inline bool GetReplicateMovement() { return bReplicateMovement; };
/** mesh component to indicate hand placement */
#if WITH_EDITORONLY_DATA
@ -480,5 +468,10 @@ public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, transient, Category = "Socket Data")
TObjectPtr<UHandSocketComponent> OwningSocket;
virtual void NativeInitializeAnimation() override;
virtual void NativeInitializeAnimation() override
{
Super::NativeInitializeAnimation();
OwningSocket = Cast<UHandSocketComponent>(GetOwningComponent()->GetAttachParent());
}
};

View file

@ -111,7 +111,6 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VRButtonComponent")
bool bIsEnabled;
protected:
// Current state of the button, writable to set initial value
UPROPERTY(EditAnywhere,BlueprintReadWrite, Replicated, Category = "VRButtonComponent")
bool bButtonState;
@ -119,11 +118,6 @@ protected:
// Who is allowed to change the button state
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "VRButtonComponent|Replication")
EVRStateChangeAuthorityType StateChangeAuthorityType;
public:
bool GetButtonState() { return bButtonState; }
void SetButtonState(bool bNewButtonState);
EVRStateChangeAuthorityType GetStateChangeAuthorityType() { return StateChangeAuthorityType; }
void SetStateChangeAuthorityType(EVRStateChangeAuthorityType NewStateChangeAuthorityType);
// Speed that the button de-presses when no longer interacted with
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VRButtonComponent")
@ -161,26 +155,18 @@ public:
virtual FVector GetTargetRelativeLocation();
protected:
// Overrides the default of : true and allows for controlling it like in an actor, should be default of off normally with grippable components
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface|Replication")
bool bReplicateMovement;
public:
bool GetReplicateMovement() { return bReplicateMovement; }
void SetReplicateMovement(bool bNewReplicateMovement);
virtual void PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker) override;
// Resetting the initial transform here so that it comes in prior to BeginPlay and save loading.
virtual void OnRegister() override;
protected:
// Now replicating this so that it works correctly over the network
UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_InitialRelativeTransform, Category = "VRButtonComponent")
FTransform_NetQuantize InitialRelativeTransform;
public:
// Gets the initial relative transform, if you want to set it you should be using ResetInitialButtonLocation
FTransform GetInitialRelativeTransform() { return InitialRelativeTransform; }
UFUNCTION()
virtual void OnRep_InitialRelativeTransform()

View file

@ -120,13 +120,9 @@ public:
// Resetting the initial transform here so that it comes in prior to BeginPlay and save loading.
virtual void OnRegister() override;
protected:
// Now replicating this so that it works correctly over the network
UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_InitialRelativeTransform, Category = "VRDialComponent")
FTransform_NetQuantize InitialRelativeTransform;
public:
// Gets the initial relative transform, if you want to set it you should be using ResetInitialButtonLocation
FTransform GetInitialRelativeTransform() { return InitialRelativeTransform; }
FTransform_NetQuantize InitialRelativeTransform;
UFUNCTION()
virtual void OnRep_InitialRelativeTransform()
@ -165,12 +161,15 @@ public:
TagContainer = GameplayTags;
}
protected:
/** Tags that are set on this object */
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "GameplayTags")
FGameplayTagContainer GameplayTags;
// End Gameplay Tag Interface
virtual void PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker) override;
// Requires bReplicates to be true for the component
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
bool bRepGameplayTags;
@ -178,14 +177,7 @@ protected:
// Overrides the default of : true and allows for controlling it like in an actor, should be default of off normally with grippable components
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface|Replication")
bool bReplicateMovement;
public:
FGameplayTagContainer& GetGameplayTags();
bool GetRepGameplayTags() { return bRepGameplayTags; }
void SetRepGameplayTags(bool bNewRepGameplayTags);
bool GetReplicateMovement() { return bReplicateMovement; }
void SetReplicateMovement(bool bNewReplicateMovement);
virtual void PreReplication(IRepChangedPropertyTracker& ChangedPropertyTracker) override;
virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
virtual void BeginPlay() override;

View file

@ -193,13 +193,9 @@ public:
// Resetting the initial transform here so that it comes in prior to BeginPlay and save loading.
virtual void OnRegister() override;
protected:
// Now replicating this so that it works correctly over the network
UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_InitialRelativeTransform, Category = "VRLeverComponent")
FTransform_NetQuantize InitialRelativeTransform;
public:
// Gets the initial relative transform, if you want to set it you should be using ResetInitialButtonLocation
FTransform GetInitialRelativeTransform() { return InitialRelativeTransform; }
UFUNCTION()
virtual void OnRep_InitialRelativeTransform()
@ -238,12 +234,15 @@ public:
TagContainer = GameplayTags;
}
protected:
/** Tags that are set on this object */
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "GameplayTags")
FGameplayTagContainer GameplayTags;
// End Gameplay Tag Interface
virtual void PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker) override;
// Requires bReplicates to be true for the component
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
bool bRepGameplayTags;
@ -251,14 +250,7 @@ protected:
// Overrides the default of : true and allows for controlling it like in an actor, should be default of off normally with grippable components
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface|Replication")
bool bReplicateMovement;
public:
FGameplayTagContainer& GetGameplayTags();
bool GetRepGameplayTags() { return bRepGameplayTags; }
void SetRepGameplayTags(bool bNewRepGameplayTags);
bool GetReplicateMovement() { return bReplicateMovement; }
void SetReplicateMovement(bool bNewReplicateMovement);
virtual void PreReplication(IRepChangedPropertyTracker& ChangedPropertyTracker) override;
virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
virtual void BeginPlay() override;

View file

@ -94,12 +94,15 @@ public:
TagContainer = GameplayTags;
}
protected:
/** Tags that are set on this object */
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "GameplayTags")
FGameplayTagContainer GameplayTags;
// End Gameplay Tag Interface
virtual void PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker) override;
// Requires bReplicates to be true for the component
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
bool bRepGameplayTags;
@ -107,14 +110,7 @@ protected:
// Overrides the default of : true and allows for controlling it like in an actor, should be default of off normally with grippable components
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface|Replication")
bool bReplicateMovement;
public:
FGameplayTagContainer& GetGameplayTags();
bool GetRepGameplayTags() { return bRepGameplayTags; }
void SetRepGameplayTags(bool bNewRepGameplayTags);
bool GetReplicateMovement() { return bReplicateMovement; }
void SetReplicateMovement(bool bNewReplicateMovement);
virtual void PreReplication(IRepChangedPropertyTracker& ChangedPropertyTracker) override;
virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
virtual void BeginPlay() override;
@ -150,7 +146,11 @@ public:
// Should be called after the Mount is moved post begin play
UFUNCTION(BlueprintCallable, Category = "VRMountComponent")
void ResetInitialMountLocation();
void ResetInitialMountLocation()
{
// Get our initial relative transform to our parent (or not if un-parented).
InitialRelativeTransform = this->GetRelativeTransform();
}
virtual void OnUnregister() override;;

View file

@ -147,13 +147,9 @@ public:
UFUNCTION(BlueprintCallable, Category = "GripSettings")
void SetGripPriority(int NewGripPriority);
protected:
// Set this to assign a spline component to the slider
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Replicated/*Using = OnRep_SplineComponentToFollow*/, Category = "VRSliderComponent")
TObjectPtr<USplineComponent> SplineComponentToFollow;
public:
// Gets the initial relative transform, if you want to set it you should be using ResetInitialButtonLocation
TObjectPtr<USplineComponent> GetSplineComponentToFollow() { return SplineComponentToFollow; }
/*UFUNCTION()
virtual void OnRep_SplineComponentToFollow()
@ -202,13 +198,9 @@ public:
// Resetting the initial transform here so that it comes in prior to BeginPlay and save loading.
virtual void OnRegister() override;
protected:
// Now replicating this so that it works correctly over the network
UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_InitialRelativeTransform, Category = "VRSliderComponent")
FTransform_NetQuantize InitialRelativeTransform;
public:
// Gets the initial relative transform, if you want to set it you should be using ResetInitialButtonLocation
FTransform GetInitialRelativeTransform() { return InitialRelativeTransform; }
UFUNCTION()
virtual void OnRep_InitialRelativeTransform()
@ -269,13 +261,15 @@ public:
TagContainer = GameplayTags;
}
protected:
/** Tags that are set on this object */
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "GameplayTags")
FGameplayTagContainer GameplayTags;
// End Gameplay Tag Interface
virtual void PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker) override;
// Requires bReplicates to be true for the component
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface")
bool bRepGameplayTags;
@ -283,14 +277,7 @@ protected:
// Overrides the default of : true and allows for controlling it like in an actor, should be default of off normally with grippable components
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRGripInterface|Replication")
bool bReplicateMovement;
public:
FGameplayTagContainer& GetGameplayTags();
bool GetRepGameplayTags() { return bRepGameplayTags; }
void SetRepGameplayTags(bool bNewRepGameplayTags);
bool GetReplicateMovement() { return bReplicateMovement; }
void SetReplicateMovement(bool bNewReplicateMovement);
virtual void PreReplication(IRepChangedPropertyTracker& ChangedPropertyTracker) override;
virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
virtual void BeginPlay() override;

View file

@ -216,7 +216,15 @@ public:
Super::Initialize(Collection);
}
virtual void Deinitialize() override;
virtual void Deinitialize() override
{
Super::Deinitialize();
if (UpdateHandle.IsValid())
{
GetWorld()->GetTimerManager().ClearTimer(UpdateHandle);
}
}
UPROPERTY()
TMap<FCollisionPrimPair, FCollisionIgnorePairArray> CollisionTrackedPairs;

View file

@ -20,12 +20,8 @@ class VREXPANSIONPLUGIN_API UNoRepSphereComponent : public USphereComponent
public:
UNoRepSphereComponent(const FObjectInitializer& ObjectInitializer);
protected:
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "Component Replication")
bool bReplicateMovement;
public:
bool GetReplicateMovement() { return bReplicateMovement; }
void SetReplicateMovement(bool bNewReplicateMovement);
virtual void PreReplication(IRepChangedPropertyTracker& ChangedPropertyTracker) override;
};
@ -67,14 +63,11 @@ class VREXPANSIONPLUGIN_API UInversePhysicsSkeletalMeshComponent : public USkele
public:
UInversePhysicsSkeletalMeshComponent(const FObjectInitializer& ObjectInitializer);
protected:
public:
// Overrides the default of : true and allows for controlling it like in an actor, should be default of off normally with grippable components
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "Component Replication")
bool bReplicateMovement;
public:
bool GetReplicateMovement() { return bReplicateMovement; }
void SetReplicateMovement(bool bNewReplicateMovement);
// This is all overrides to fix the skeletal mesh inverse simulation bug
// WILL BE REMOVED LATER when the engine is fixed

View file

@ -377,8 +377,6 @@ protected:
void RemoveAllQueriesByListener(const FPerceptionListener& Listener, const TFunction<void(const FAISightQueryVR&)>& OnRemoveFunc = nullptr);
void RemoveAllQueriesToTarget(const FAISightTargetVR::FTargetId& TargetId, const TFunction<void(const FAISightQueryVR&)>& OnRemoveFunc = nullptr);
/** RemoveAllQueriesToTarget version that need to already have a write access on QueriesListAccessDetector*/
void RemoveAllQueriesToTarget_Internal(const FAISightTargetVR::FTargetId& TargetId, const TFunction<void(const FAISightQueryVR&)>& OnRemoveFunc = nullptr);
/** returns information whether new LoS queries have been added */
bool RegisterTarget(AActor& TargetActor, const TFunction<void(FAISightQueryVR&)>& OnAddedFunc = nullptr);

View file

@ -5,8 +5,8 @@
//#include "UObject/ObjectMacros.h"
#include "Components/ActorComponent.h"
#include "EngineDefines.h"
#if UE_ENABLE_DEBUG_DRAWING
//#include "Chaos/DebugDrawQueue.h"
#if ENABLE_DRAW_DEBUG
#include "Chaos/DebugDrawQueue.h"
#endif
#include "VREPhysicalAnimationComponent.generated.h"
@ -89,11 +89,11 @@ public:
/** If true then we will debug draw the mesh collision post shape alterations */
//UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = WeldedBoneDriver)
//bool bDebugDrawCollision = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = WeldedBoneDriver)
bool bDebugDrawCollision = false;
#if UE_ENABLE_DEBUG_DRAWING
//void DebugDrawMesh(const TArray<Chaos::FLatentDrawCommand>& DrawCommands);
#if ENABLE_DRAW_DEBUG
void DebugDrawMesh(const TArray<Chaos::FLatentDrawCommand>& DrawCommands);
#endif
FTransform GetWorldSpaceRefBoneTransform(FReferenceSkeleton& RefSkel, int32 BoneIndex, int32 ParentBoneIndex);

View file

@ -3,7 +3,6 @@
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "Engine/Canvas.h"
#include "Engine/TextureRenderTarget2D.h"
#include "Engine/Console.h"

View file

@ -1,8 +1,5 @@
#pragma once
#include "TimerManager.h"
#include "GameFramework/Actor.h"
#include "Components/ActorComponent.h"
#include "Containers/Queue.h"
#include "VRRenderTargetManager.generated.h"
class UVRRenderTargetManager;
@ -11,8 +8,6 @@ class UCanvas;
class UTexture2D;
class UMaterial;
class APlayerController;
class FRenderCommandFence;
enum EPixelFormat : uint8;
// #TODO: Dirty rects so don't have to send entire texture?
@ -219,7 +214,14 @@ public:
UPROPERTY()
int32 MaxBytesPerSecondRate;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override
{
if(SendTimer_Handle.IsValid())
GetWorld()->GetTimerManager().ClearTimer(SendTimer_Handle);
Super::EndPlay(EndPlayReason);
}
UFUNCTION(Reliable, Server, WithValidation)
void SendLocalDrawOperations(const TArray<FRenderManagerOperation>& LocalRenderOperationStoreList);

View file

@ -1,154 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "MoverComponent.h"
#include "MoverTypes.h"
#include "GameFramework/Pawn.h"
#include "LayeredMove.h"
#include "VRMoverComponent.generated.h"
class UCurveVector;
class UCurveFloat;
DECLARE_LOG_CATEGORY_EXTERN(LogVRMoverComponent, Log, All);
/** Linear Velocity: A method of inducing a straight-line velocity on an actor over time */
USTRUCT(BlueprintType)
struct VREXPANSIONPLUGIN_API FLayeredMove_VRMovement : public FLayeredMoveBase
{
GENERATED_USTRUCT_BODY()
FLayeredMove_VRMovement();
virtual ~FLayeredMove_VRMovement() {}
// Units per second, could be worldspace vs relative depending on Flags
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Mover)
FVector Velocity;
// Optional curve float for controlling the magnitude of the velocity applied to the actor over the duration of the move
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Mover)
TObjectPtr<UCurveFloat> MagnitudeOverTime;
// @see ELayeredMove_ConstantVelocitySettingsFlags
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Mover)
uint8 SettingsFlags;
// Never finish this movement
virtual bool IsFinished(float CurrentSimTimeMs) const;
// Generate a movement
virtual bool GenerateMove(const FMoverTickStartData& StartState, const FMoverTimeStep& TimeStep, const UMoverComponent* MoverComp, UMoverBlackboard* SimBlackboard, FProposedMove& OutProposedMove) override;
virtual FLayeredMoveBase* Clone() const override;
virtual void NetSerialize(FArchive& Ar) override;
virtual UScriptStruct* GetScriptStruct() const override;
virtual FString ToSimpleString() const override;
virtual void AddReferencedObjects(class FReferenceCollector& Collector) override;
};
template<>
struct TStructOpsTypeTraits< FLayeredMove_VRMovement > : public TStructOpsTypeTraitsBase2< FLayeredMove_VRMovement >
{
enum
{
//WithNetSerializer = true,
WithCopy = true
};
};
// Data block containing basic sync state information
USTRUCT(BlueprintType)
struct VREXPANSIONPLUGIN_API FVRMoverHMDSyncState : public FMoverDataStructBase
{
GENERATED_USTRUCT_BODY()
public:
// Movement intent direction relative to MovementBase if set, world space otherwise. Magnitude of range (0-1)
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = Mover)
FVector MoveDirectionIntent;
public:
FVRMoverHMDSyncState()
{
// In constructor list when the actual var is made
MoveDirectionIntent = FVector::ZeroVector;
}
virtual ~FVRMoverHMDSyncState() {}
// @return newly allocated copy of this FMoverDefaultSyncState. Must be overridden by child classes
virtual FMoverDataStructBase* Clone() const override;
virtual bool NetSerialize(FArchive& Ar, UPackageMap* Map, bool& bOutSuccess) override;
virtual UScriptStruct* GetScriptStruct() const override { return StaticStruct(); }
// Need implemented (if needed)
virtual bool ShouldReconcile(const FMoverDataStructBase& AuthorityState) const override
{
return false;
}
// Needs implemented (should we even do this?)
virtual void Interpolate(const FMoverDataStructBase& From, const FMoverDataStructBase& To, float Pct) override
{
return;
}
};
template<>
struct TStructOpsTypeTraits< FVRMoverHMDSyncState > : public TStructOpsTypeTraitsBase2< FVRMoverHMDSyncState >
{
enum
{
WithNetSerializer = true,
WithCopy = true
};
};
UCLASS()
class VREXPANSIONPLUGIN_API AVRMoverBasePawn : public APawn, public IMoverInputProducerInterface
{
GENERATED_BODY()
public:
// Sets default values for this pawn's properties
AVRMoverBasePawn(const FObjectInitializer& ObjectInitializer);
/** Accessor for the actor's movement component */
UFUNCTION(BlueprintPure, Category = Mover)
UMoverComponent* GetMoverComponent() const { return CharacterMotionComponent; }
virtual void BeginPlay() override;
protected:
virtual UPrimitiveComponent* GetMovementBase() const override;
// Entry point for input production. Do not override. To extend in derived character types, override OnProduceInput for native types or implement "Produce Input" blueprint event
virtual void ProduceInput_Implementation(int32 SimTimeMs, FMoverInputCmdContext& InputCmdResult) override;
// Override this function in native class to author input for the next simulation frame. Consider also calling Super method.
virtual void OnProduceInput(float DeltaMs, FMoverInputCmdContext& InputCmdResult);
// Implement this event in Blueprints to author input for the next simulation frame. Consider also calling Parent event.
UFUNCTION(BlueprintImplementableEvent, DisplayName = "On Produce Input", meta = (ScriptName = "OnProduceInput"))
FMoverInputCmdContext OnProduceInputInBlueprint(float DeltaMs, FMoverInputCmdContext InputCmd);
protected:
UPROPERTY(Category = Movement, VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
TObjectPtr<UMoverComponent> CharacterMotionComponent;
uint8 bHasProduceInputinBpFunc : 1;
};

View file

@ -106,11 +106,6 @@ public:
UPROPERTY(EditDefaultsOnly, ReplicatedUsing = OnRep_ReplicatedCameraTransform, Category = "ReplicatedCamera|Networking")
FBPVRComponentPosRep ReplicatedCameraTransform;
// Returns the actual tracked transform of the HMD, as with RetainRoomscale = False we do not set the camera to it
// Can also just use the HMD function library but this is a fast way if you already have a camera reference
UFUNCTION(BlueprintPure, Category = "ReplicatedCamera|Tracking")
FTransform GetHMDTrackingTransform();
FVector LastUpdatesRelativePosition = FVector::ZeroVector;
FRotator LastUpdatesRelativeRotation = FRotator::ZeroRotator;
@ -120,10 +115,9 @@ public:
// Run the smoothing step
void RunNetworkedSmoothing(float DeltaTime);
// Whether to smooth (lerp) between ticks for the replicated motion, DOES NOTHING if update rate is larger than FPS!
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ReplicatedCamera|Networking")
bool bSmoothReplicatedMotion = true;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "ReplicatedCamera|Networking")
bool bSmoothReplicatedMotion;
// If true then we will use exponential smoothing with buffered correction
UPROPERTY(EditAnywhere, Category = "ReplicatedCamera|Networking|Smoothing", meta = (editcondition = "bSmoothReplicatedMotion"))
@ -144,19 +138,14 @@ public:
UFUNCTION()
virtual void OnRep_ReplicatedCameraTransform();
protected:
// Rate to update the position to the server, 100htz is default (same as replication rate, should also hit every tick).
// On dedicated servers the update rate should be at or lower than the server tick rate for smoothing to work
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "ReplicatedCamera|Networking")
float NetUpdateRate;
public:
// Used in Tick() to accumulate before sending updates, didn't want to use a timer in this case.
float NetUpdateCount;
float GetNetUpdateRate() { return NetUpdateRate; }
void SetNetUpdateRate(float NewNetUpdateRate);
// I'm sending it unreliable because it is being resent pretty often
UFUNCTION(Unreliable, Server, WithValidation)
void Server_SendCameraTransform(FBPVRComponentPosRep NewTransform);
@ -166,7 +155,14 @@ public:
VRBaseCharTransformRPC_Pointer OverrideSendTransform;
// Need this as I can't think of another way for an actor component to make sure it isn't on the server
bool IsLocallyControlled() const;
inline bool IsLocallyControlled() const
{
// I like epics new authority check more than my own
const AActor* MyOwner = GetOwner();
return MyOwner->HasLocalNetOwner();
//const APawn* MyPawn = Cast<APawn>(MyOwner);
//return MyPawn ? MyPawn->IsLocallyControlled() : false;// (MyOwner->Role == ENetRole::ROLE_Authority);
}
//bool IsServer();
};

View file

@ -14,7 +14,6 @@
class UGripMotionControllerComponent;
class UVRGripScriptBase;
class UPrimitiveComponent;
// Custom movement modes for the characters
UENUM(BlueprintType)
@ -1468,13 +1467,6 @@ public:
float LerpSpeed;
FTransform OnGripTransform;
/////////////////////
// TMP: Velocity calculation addition for 5.4 #TODO: Remove this when the bug is fixed
FVector LinVel = FVector::ZeroVector;
FVector RotVel = FVector::ZeroVector;
FTransform LastVelWorldTrans; // Identity by default
///////////////////////
UPROPERTY(BlueprintReadWrite, NotReplicated, Category = "Settings")
bool bIsLerping;
@ -1558,9 +1550,15 @@ public:
}
AActor* GetGrippedActor() const;
FORCEINLINE AActor * GetGrippedActor() const
{
return Cast<AActor>(GrippedObject);
}
UPrimitiveComponent* GetGrippedComponent() const;
FORCEINLINE UPrimitiveComponent * GetGrippedComponent() const
{
return Cast<UPrimitiveComponent>(GrippedObject);
}
//Check if a grip is the same as another, the only things I check for are the actor / component
//This is here for the Find() function from TArray
@ -1582,7 +1580,13 @@ public:
return false;
}
bool operator==(const UPrimitiveComponent* Other) const;
FORCEINLINE bool operator==(const UPrimitiveComponent * Other) const
{
if (Other && GrippedObject && GrippedObject == (const UObject*)Other)
return true;
return false;
}
FORCEINLINE bool operator==(const UObject * Other) const
{
@ -1864,11 +1868,11 @@ public:
bEnableVelocityDrive = ConstraintDrive.bEnableVelocityDrive;
}
void FillTo(FConstraintDrive& ConstraintDrive, float DampingScaler = 1.0f, float StiffnessScaler = 1.0f) const
void FillTo(FConstraintDrive& ConstraintDrive) const
{
ConstraintDrive.Damping = Damping * DampingScaler;
ConstraintDrive.Stiffness = Stiffness * StiffnessScaler;
ConstraintDrive.MaxForce = (float)FMath::Clamp<double>((double)ConstraintDrive.Stiffness * (double)MaxForceCoefficient, 0, (double)MAX_FLT);
ConstraintDrive.Damping = Damping;
ConstraintDrive.Stiffness = Stiffness;
ConstraintDrive.MaxForce = MaxForceCoefficient * Stiffness;
ConstraintDrive.bEnablePositionDrive = bEnablePositionDrive;
ConstraintDrive.bEnableVelocityDrive = bEnableVelocityDrive;
}
@ -1925,5 +1929,27 @@ public:
return true;
}
bool FillTo(FBPActorPhysicsHandleInformation* HandleInfo, bool bModifyWithScalers = true) const;
bool FillTo(FBPActorPhysicsHandleInformation* HandleInfo) const
{
if (!HandleInfo)
return false;
XAxisSettings.FillTo(HandleInfo->LinConstraint.XDrive);
YAxisSettings.FillTo(HandleInfo->LinConstraint.YDrive);
ZAxisSettings.FillTo(HandleInfo->LinConstraint.ZDrive);
if ((SlerpSettings.bEnablePositionDrive || SlerpSettings.bEnableVelocityDrive))
{
HandleInfo->AngConstraint.AngularDriveMode = EAngularDriveMode::SLERP;
SlerpSettings.FillTo(HandleInfo->AngConstraint.SlerpDrive);
}
else
{
HandleInfo->AngConstraint.AngularDriveMode = EAngularDriveMode::TwistAndSwing;
TwistSettings.FillTo(HandleInfo->AngConstraint.TwistDrive);
SwingSettings.FillTo(HandleInfo->AngConstraint.SwingDrive);
}
return true;
}
};

View file

@ -13,7 +13,6 @@ class AVRPlayerController;
class UGripMotionControllerComponent;
class UParentRelativeAttachmentComponent;
class AController;
class UNavigationQueryFilter;
DECLARE_LOG_CATEGORY_EXTERN(LogBaseVRCharacter, Log, All);
@ -281,7 +280,7 @@ public:
// If true then we will retain roomscale tracking in relative space of the character.
// If false than the movement component will offset to the hmd tracking and the tracking will be nulled out
UPROPERTY(Category = VRBaseCharacter, EditAnywhere, BlueprintReadOnly)
bool bRetainRoomscale = false;
bool bRetainRoomscale = true;
//virtual void CacheInitialMeshOffset(FVector MeshRelativeLocation, FRotator MeshRelativeRotation) override;
virtual void PostInitializeComponents() override;
@ -331,14 +330,9 @@ public:
virtual void PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker) override;
protected:
// If true will replicate the capsule height on to clients, allows for dynamic capsule height changes in multiplayer
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "VRBaseCharacter")
bool VRReplicateCapsuleHeight;
public:
bool GetVRReplicateCapsuleHeight() { return VRReplicateCapsuleHeight; }
void SetVRReplicateCapsuleHeight(bool bNewVRReplicateCapsuleHeight);
// OnlyReplicated to simulated clients
UPROPERTY(Replicated, ReplicatedUsing = OnRep_CapsuleHeight)

View file

@ -6,7 +6,6 @@
//#include "Engine/Engine.h"
#include "VRBPDatatypes.h"
#include "Engine/DataAsset.h"
#include "Components\SceneComponent.h"
//#include "Engine/EngineTypes.h"
//#include "Engine/EngineBaseTypes.h"
@ -319,7 +318,7 @@ public:
return FVector::DistSquared(Seq1, Seq2);
}
virtual void BeginDestroy() override;
void BeginDestroy() override;
// Recalculates a gestures size and re-scales it to the given database
UFUNCTION(BlueprintCallable, Category = "VRGestures")

View file

@ -230,9 +230,6 @@ public:
return bInsideVolume;
}
// Expose this
inline float GetLineThickness() const {return LineThickness;}
public:
// Begin UObject interface
#if WITH_EDITOR

View file

@ -117,7 +117,6 @@ public:
TObjectPtr<UStereoLayerShape> Shape;
void BeginDestroy() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
void OnUnregister() override;
virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
virtual void DrawWidgetToRenderTarget(float DeltaTime) override;
@ -177,10 +176,6 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "StereoLayer")
uint32 bQuadPreserveTextureRatio : 1;
/** Additional flags not included in IStereoLayers::ELayerFlags */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "StereoLayer", Meta = (GetOptions = "EditorFlagCollector.GetFlagNames"))
TArray<FName> AdditionalFlags;
protected:
/** Texture displayed on the stereo layer (is stereocopic textures are supported on the platfrom and more than one texture is provided, this will be the right eye) **/
//UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "StereoLayer")
@ -225,9 +220,6 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadOnly, export, Category = "StereoLayer")
int32 Priority;
/** IStereoLayer id, 0 is unassigned **/
uint32 LayerId;
bool bShouldCreateProxy;
private:
@ -238,6 +230,9 @@ private:
/** Texture needs to be marked for update **/
bool bTextureNeedsUpdate;
/** IStereoLayer id, 0 is unassigned **/
uint32 LayerId;
/** Last transform is cached to determine if the new frames transform has changed **/
FTransform LastTransform;

View file

@ -59,15 +59,23 @@ public class VRExpansionPlugin : ModuleRules
"NetCore",
"CoreUObject",
"Engine",
// "InputCore",
"PhysicsCore",
//"FLEX", remove comment if building in the NVIDIA flex branch - NOTE when put in place FLEX only listed win32 and win64 at compatible platforms
"HeadMountedDisplay",
// "RHI",
//"RenderCore",
//"ShaderCore",
//"NetworkReplayStreaming",
//"AIModule",
"UMG",
"NavigationSystem",
"AIModule",
"AnimGraphRuntime",
"XRBase",
"GameplayTags",
"Mover"
"GameplayTags"
//"Renderer",
//"UtilityShaders"
});
//if(Target.bUseChaos)
@ -106,6 +114,20 @@ public class VRExpansionPlugin : ModuleRules
}
);
// Don't load APEX on incompatible platforms
/* if (
Target.Platform != UnrealTargetPlatform.IOS &&
Target.Platform != UnrealTargetPlatform.TVOS &&
Target.Platform != UnrealTargetPlatform.Android &&
Target.Platform != UnrealTargetPlatform.HTML5)
{
PublicDependencyModuleNames.AddRange(
new string[]
{
"APEX"
});
}*/
// Allow gameplay debugger on editor builds
if (Target.bBuildDeveloperTools || (Target.Configuration != UnrealTargetConfiguration.Shipping && Target.Configuration != UnrealTargetConfiguration.Test))
{

View file

@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 5.4,
"VersionName": "5.4",
"Version": 5.3,
"VersionName": "5.3",
"FriendlyName": "VRExpansionPlugin",
"Description": "Adds several new VR features & components to UE4",
"Category": "VRExpansion",
@ -33,7 +33,7 @@
"LoadingPhase": "PostEngineInit"
}
],
"Plugins": [
"Plugins": [
{
"Name": "ChaosVehiclesPlugin",
"Enabled": true
@ -41,10 +41,6 @@
{
"Name": "XRBase",
"Enabled": true
},
{
"Name": "Mover",
"Enabled": true
}
]
]
}