Updated VRE
This commit is contained in:
		
							parent
							
								
									9657f9135f
								
							
						
					
					
						commit
						6db822feb1
					
				
					 25 changed files with 351 additions and 98 deletions
				
			
		
							
								
								
									
										
											BIN
										
									
								
								VIRTUOS_ExpansionPluginTests/Content/MainMenu/UI_Materials/M_UI_Liquid_Fill_Button.uasset
									 (Stored with Git LFS)
										
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								VIRTUOS_ExpansionPluginTests/Content/MainMenu/UI_Materials/M_UI_Liquid_Fill_Button.uasset
									 (Stored with Git LFS)
										
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								VIRTUOS_ExpansionPluginTests/Content/Maps/Map_MainMenu.umap
									 (Stored with Git LFS)
										
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								VIRTUOS_ExpansionPluginTests/Content/Maps/Map_MainMenu.umap
									 (Stored with Git LFS)
										
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -369,7 +369,7 @@ bool FVRCharacterNetworkMoveData::Serialize(UCharacterMovementComponent& Charact
 | 
			
		|||
 | 
			
		||||
	if (AVRBaseCharacter* BaseChar = Cast<AVRBaseCharacter>(CharacterOwner))
 | 
			
		||||
	{
 | 
			
		||||
		if (!BaseChar->VRMovementReference->bUseClientControlRotation)
 | 
			
		||||
		if (BaseChar->VRMovementReference && !BaseChar->VRMovementReference->bUseClientControlRotation)
 | 
			
		||||
		{
 | 
			
		||||
			bRepRollAndPitch = (Roll != 0 || Pitch != 0);
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6718,25 +6718,15 @@ bool UGripMotionControllerComponent::SetGripConstraintStiffnessAndDamping(const
 | 
			
		|||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						if (VRSettings.bUseChaosTranslationScalers)
 | 
			
		||||
						{
 | 
			
		||||
							Stiffness *= VRSettings.LinearDriveStiffnessScale;
 | 
			
		||||
							Damping *= VRSettings.LinearDriveDampingScale;
 | 
			
		||||
							AngularStiffness *= VRSettings.AngularDriveStiffnessScale;
 | 
			
		||||
							AngularDamping *= 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"));
 | 
			
		||||
						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"));
 | 
			
		||||
 | 
			
		||||
							Stiffness *= CVarLinearDriveStiffnessScale->GetFloat();
 | 
			
		||||
							Damping *= CVarLinearDriveDampingScale->GetFloat();
 | 
			
		||||
							AngularStiffness *= CVarAngularDriveStiffnessScale->GetFloat();
 | 
			
		||||
							AngularDamping *= CVarAngularDriveDampingScale->GetFloat();
 | 
			
		||||
						}
 | 
			
		||||
						Stiffness *= CVarLinearDriveStiffnessScale->GetFloat();
 | 
			
		||||
						Damping *= CVarLinearDriveDampingScale->GetFloat();
 | 
			
		||||
						AngularStiffness *= CVarAngularDriveStiffnessScale->GetFloat();
 | 
			
		||||
						AngularDamping *= CVarAngularDriveDampingScale->GetFloat();
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					AngularMaxForce = (float)FMath::Clamp<double>((double)AngularStiffness * (double)Grip->AdvancedGripSettings.PhysicsSettings.AngularMaxForceCoefficient, 0, (double)MAX_FLT);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -513,8 +513,11 @@ void UGS_GunTools::GetVirtualStockTarget(UGripMotionControllerComponent * Grippi
 | 
			
		|||
	{
 | 
			
		||||
		if (AVRBaseCharacter * vrOwner = Cast<AVRBaseCharacter>(GrippingController->GetOwner()))
 | 
			
		||||
		{
 | 
			
		||||
			CameraComponent = vrOwner->VRReplicatedCamera;
 | 
			
		||||
			return;
 | 
			
		||||
			if (vrOwner->VRReplicatedCamera)
 | 
			
		||||
			{
 | 
			
		||||
				CameraComponent = vrOwner->VRReplicatedCamera;
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,8 +9,13 @@
 | 
			
		|||
#include "Components/PrimitiveComponent.h"
 | 
			
		||||
#include "GameFramework/Actor.h"
 | 
			
		||||
#include "Net/UnrealNetwork.h"
 | 
			
		||||
#include "Net/Core/PushModel/PushModel.h"
 | 
			
		||||
#include "Engine/NetDriver.h"
 | 
			
		||||
 | 
			
		||||
#if UE_WITH_IRIS
 | 
			
		||||
#include "Iris/ReplicationSystem/ReplicationFragmentUtil.h"
 | 
			
		||||
#endif // UE_WITH_IRIS
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
UVRGripScriptBase::UVRGripScriptBase(const FObjectInitializer& ObjectInitializer)
 | 
			
		||||
	: Super(ObjectInitializer)
 | 
			
		||||
| 
						 | 
				
			
			@ -69,6 +74,18 @@ UVRGripScriptBase* UVRGripScriptBase::GetGripScriptByClass(UObject* WorldContext
 | 
			
		|||
	return nullptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if UE_WITH_IRIS
 | 
			
		||||
void UVRGripScriptBase::RegisterReplicationFragments(UE::Net::FFragmentRegistrationContext& Context, UE::Net::EFragmentRegistrationFlags RegistrationFlags)
 | 
			
		||||
{
 | 
			
		||||
	using namespace UE::Net;
 | 
			
		||||
 | 
			
		||||
	Super::RegisterReplicationFragments(Context, RegistrationFlags);
 | 
			
		||||
 | 
			
		||||
	// Build descriptors and allocate PropertyReplicationFragments for this object
 | 
			
		||||
	FReplicationFragmentUtil::CreateAndRegisterFragmentsForObject(this, Context, RegistrationFlags);
 | 
			
		||||
}
 | 
			
		||||
#endif // UE_WITH_IRIS
 | 
			
		||||
 | 
			
		||||
void UVRGripScriptBase::GetLifetimeReplicatedProps(TArray< class FLifetimeProperty > & OutLifetimeProps) const
 | 
			
		||||
{
 | 
			
		||||
	// Uobject has no replicated props
 | 
			
		||||
| 
						 | 
				
			
			@ -80,6 +97,56 @@ void UVRGripScriptBase::GetLifetimeReplicatedProps(TArray< class FLifetimeProper
 | 
			
		|||
	{
 | 
			
		||||
		BPClass->GetLifetimeBlueprintReplicationList(OutLifetimeProps);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	FDoRepLifetimeParams SharedParams;
 | 
			
		||||
	SharedParams.bIsPushBased = true;
 | 
			
		||||
 | 
			
		||||
	DOREPLIFETIME_WITH_PARAMS(UVRGripScriptBase, bReplicates, SharedParams);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void UVRGripScriptBase::SetIsReplicated(bool bShouldReplicate)
 | 
			
		||||
{
 | 
			
		||||
	if (GetIsReplicated() != bShouldReplicate)
 | 
			
		||||
	{
 | 
			
		||||
		bReplicates = bShouldReplicate;
 | 
			
		||||
 | 
			
		||||
		FBoolProperty* BoolProperty = CastField<FBoolProperty>(this->GetClass()->FindPropertyByName("bReplicates"));
 | 
			
		||||
		MARK_PROPERTY_DIRTY(this, BoolProperty);
 | 
			
		||||
		//MARK_PROPERTY_DIRTY_FROM_NAME(UVRGripScriptBase, bReplicates, this);
 | 
			
		||||
 | 
			
		||||
		// Remove us from the subobject replication list if we need to be
 | 
			
		||||
		if (AActor* OwningActor = Cast<AActor>(GetParent()))
 | 
			
		||||
		{
 | 
			
		||||
			if (OwningActor->IsUsingRegisteredSubObjectList())
 | 
			
		||||
			{
 | 
			
		||||
				if (bReplicates)
 | 
			
		||||
				{
 | 
			
		||||
					if (!OwningActor->IsReplicatedSubObjectRegistered(this))
 | 
			
		||||
					{
 | 
			
		||||
						OwningActor->AddReplicatedSubObject(this);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if(OwningActor->IsReplicatedSubObjectRegistered(this))
 | 
			
		||||
				{
 | 
			
		||||
					OwningActor->RemoveReplicatedSubObject(this);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (UActorComponent* OwningComp = Cast<UActorComponent>(GetParent()))
 | 
			
		||||
		{
 | 
			
		||||
			if (bReplicates)
 | 
			
		||||
			{
 | 
			
		||||
				if (!OwningComp->IsReplicatedSubObjectRegistered(this))
 | 
			
		||||
				{
 | 
			
		||||
					OwningComp->AddReplicatedSubObject(this);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			else if (OwningComp->IsReplicatedSubObjectRegistered(this))
 | 
			
		||||
			{
 | 
			
		||||
				OwningComp->RemoveReplicatedSubObject(this);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void UVRGripScriptBase::Tick(float DeltaTime)
 | 
			
		||||
| 
						 | 
				
			
			@ -320,14 +387,73 @@ UWorld* UVRGripScriptBase::GetWorld() const
 | 
			
		|||
 | 
			
		||||
void UVRGripScriptBase::EndPlay(const EEndPlayReason::Type EndPlayReason)
 | 
			
		||||
{
 | 
			
		||||
	// Remove us from the subobject replication list if we need to be
 | 
			
		||||
	if (AActor* OwningActor = Cast<AActor>(GetParent()))
 | 
			
		||||
	{
 | 
			
		||||
		if (OwningActor->IsUsingRegisteredSubObjectList())
 | 
			
		||||
		{
 | 
			
		||||
			OwningActor->RemoveReplicatedSubObject(this);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	else if (UActorComponent* OwningComp = Cast<UActorComponent>(GetParent()))
 | 
			
		||||
	{
 | 
			
		||||
		if (OwningComp->IsUsingRegisteredSubObjectList())
 | 
			
		||||
		{
 | 
			
		||||
			OwningComp->RemoveReplicatedSubObject(this);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	OnEndPlay(EndPlayReason);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void UVRGripScriptBase::BeginDestroy()
 | 
			
		||||
{
 | 
			
		||||
	Super::BeginDestroy();
 | 
			
		||||
 | 
			
		||||
	if (bReplicates)
 | 
			
		||||
	{
 | 
			
		||||
		// Remove us from the subobject replication list if we need to be
 | 
			
		||||
		if (AActor* OwningActor = Cast<AActor>(GetParent()))
 | 
			
		||||
		{
 | 
			
		||||
			if (OwningActor->IsUsingRegisteredSubObjectList())
 | 
			
		||||
			{
 | 
			
		||||
				OwningActor->RemoveReplicatedSubObject(this);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (UActorComponent* OwningComp = Cast<UActorComponent>(GetParent()))
 | 
			
		||||
		{
 | 
			
		||||
			if (OwningComp->IsUsingRegisteredSubObjectList())
 | 
			
		||||
			{
 | 
			
		||||
				OwningComp->RemoveReplicatedSubObject(this);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void UVRGripScriptBase::BeginPlay(UObject * CallingOwner)
 | 
			
		||||
{
 | 
			
		||||
	if (bAlreadyNotifiedPlay)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	if (bReplicates)
 | 
			
		||||
	{
 | 
			
		||||
		// Register us to the subobject replication list if we need to be
 | 
			
		||||
		if (AActor* OwningActor = Cast<AActor>(CallingOwner))
 | 
			
		||||
		{
 | 
			
		||||
			if (OwningActor->IsUsingRegisteredSubObjectList())
 | 
			
		||||
			{
 | 
			
		||||
				OwningActor->AddReplicatedSubObject(this, ReplicationCondition);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (UActorComponent* OwningComp = Cast<UActorComponent>(CallingOwner))
 | 
			
		||||
		{
 | 
			
		||||
			if (OwningComp->IsUsingRegisteredSubObjectList())
 | 
			
		||||
			{
 | 
			
		||||
				OwningComp->AddReplicatedSubObject(this, ReplicationCondition);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	bAlreadyNotifiedPlay = true;
 | 
			
		||||
 | 
			
		||||
	// Notify the subscripts about begin play
 | 
			
		||||
| 
						 | 
				
			
			@ -338,14 +464,17 @@ void UVRGripScriptBase::PostInitProperties()
 | 
			
		|||
{
 | 
			
		||||
	Super::PostInitProperties();
 | 
			
		||||
 | 
			
		||||
	//Called in game, when World exist . BeginPlay will not be called in editor
 | 
			
		||||
	if (GetWorld())
 | 
			
		||||
	if (bReplicates)
 | 
			
		||||
	{
 | 
			
		||||
		if (AActor* Owner = GetOwner())
 | 
			
		||||
		//Called in game, when World exist . BeginPlay will not be called in editor
 | 
			
		||||
		if (GetWorld())
 | 
			
		||||
		{
 | 
			
		||||
			if (Owner->IsActorInitialized())
 | 
			
		||||
			if (AActor* Owner = GetOwner())
 | 
			
		||||
			{
 | 
			
		||||
				BeginPlay(GetOwner());
 | 
			
		||||
				if (Owner->IsActorInitialized())
 | 
			
		||||
				{
 | 
			
		||||
					BeginPlay(GetParent());
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -311,7 +311,7 @@ bool AGrippableActor::ReplicateSubobjects(UActorChannel* Channel, class FOutBunc
 | 
			
		|||
{
 | 
			
		||||
	bool WroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);
 | 
			
		||||
 | 
			
		||||
	if (bReplicateGripScripts)
 | 
			
		||||
	if (bReplicateGripScripts && !IsUsingRegisteredSubObjectList())
 | 
			
		||||
	{
 | 
			
		||||
		for (UVRGripScriptBase* Script : GripLogicScripts)
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -73,7 +73,7 @@ bool UGrippableBoxComponent::ReplicateSubobjects(UActorChannel* Channel, class F
 | 
			
		|||
{
 | 
			
		||||
	bool WroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);
 | 
			
		||||
 | 
			
		||||
	if (bReplicateGripScripts)
 | 
			
		||||
	if (bReplicateGripScripts && !IsUsingRegisteredSubObjectList())
 | 
			
		||||
	{
 | 
			
		||||
		for (UVRGripScriptBase* Script : GripLogicScripts)
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -69,7 +69,7 @@ bool UGrippableCapsuleComponent::ReplicateSubobjects(UActorChannel* Channel, cla
 | 
			
		|||
{
 | 
			
		||||
	bool WroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);
 | 
			
		||||
 | 
			
		||||
	if (bReplicateGripScripts)
 | 
			
		||||
	if (bReplicateGripScripts && !IsUsingRegisteredSubObjectList())
 | 
			
		||||
	{
 | 
			
		||||
		for (UVRGripScriptBase* Script : GripLogicScripts)
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -70,7 +70,7 @@ bool UGrippableSkeletalMeshComponent::ReplicateSubobjects(UActorChannel* Channel
 | 
			
		|||
{
 | 
			
		||||
	bool WroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);
 | 
			
		||||
 | 
			
		||||
	if (bReplicateGripScripts)
 | 
			
		||||
	if (bReplicateGripScripts && !IsUsingRegisteredSubObjectList())
 | 
			
		||||
	{
 | 
			
		||||
		for (UVRGripScriptBase* Script : GripLogicScripts)
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -68,7 +68,7 @@ bool UGrippableSphereComponent::ReplicateSubobjects(UActorChannel* Channel, clas
 | 
			
		|||
{
 | 
			
		||||
	bool WroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);
 | 
			
		||||
 | 
			
		||||
	if (bReplicateGripScripts)
 | 
			
		||||
	if (bReplicateGripScripts && !IsUsingRegisteredSubObjectList())
 | 
			
		||||
	{
 | 
			
		||||
		for (UVRGripScriptBase* Script : GripLogicScripts)
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -306,7 +306,7 @@ bool AGrippableStaticMeshActor::ReplicateSubobjects(UActorChannel* Channel, clas
 | 
			
		|||
{
 | 
			
		||||
	bool WroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);
 | 
			
		||||
 | 
			
		||||
	if (bReplicateGripScripts)
 | 
			
		||||
	if (bReplicateGripScripts && !IsUsingRegisteredSubObjectList())
 | 
			
		||||
	{
 | 
			
		||||
		for (UVRGripScriptBase* Script : GripLogicScripts)
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -69,7 +69,7 @@ bool UGrippableStaticMeshComponent::ReplicateSubobjects(UActorChannel* Channel,
 | 
			
		|||
{
 | 
			
		||||
	bool WroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);
 | 
			
		||||
 | 
			
		||||
	if (bReplicateGripScripts)
 | 
			
		||||
	if (bReplicateGripScripts && !IsUsingRegisteredSubObjectList())
 | 
			
		||||
	{
 | 
			
		||||
		for (UVRGripScriptBase* Script : GripLogicScripts)
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -90,6 +90,69 @@ UAnimSequence* UHandSocketComponent::GetTargetAnimation()
 | 
			
		|||
	return HandTargetAnimation;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void UHandSocketComponent::GetAllHandSocketComponents(TArray<UHandSocketComponent*>& OutHandSockets)
 | 
			
		||||
{
 | 
			
		||||
	for (TObjectIterator<UHandSocketComponent> It; It; ++It)
 | 
			
		||||
	{
 | 
			
		||||
		UHandSocketComponent* HandSocket = *It;
 | 
			
		||||
		if (IsValid(HandSocket) && !HandSocket->IsTemplate())
 | 
			
		||||
		{
 | 
			
		||||
			OutHandSockets.Add(HandSocket);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool UHandSocketComponent::GetAllHandSocketComponentsInRange(FVector SearchFromWorldLocation, float SearchRange, TArray<UHandSocketComponent*>& OutHandSockets)
 | 
			
		||||
{
 | 
			
		||||
	float SearchDistSq = FMath::Square(SearchRange);
 | 
			
		||||
 | 
			
		||||
	UHandSocketComponent* HandSocket = nullptr;
 | 
			
		||||
	FTransform HandSocketTrans;
 | 
			
		||||
	for (TObjectIterator<UHandSocketComponent> It; It; ++It)
 | 
			
		||||
	{
 | 
			
		||||
		HandSocket = *It;
 | 
			
		||||
		if (IsValid(HandSocket) && !HandSocket->IsTemplate())
 | 
			
		||||
		{
 | 
			
		||||
			HandSocketTrans = HandSocket->GetRelativeTransform() * HandSocket->GetOwner()->GetActorTransform();
 | 
			
		||||
			if (FVector::DistSquared(HandSocketTrans.GetLocation(), SearchFromWorldLocation) <= SearchDistSq)
 | 
			
		||||
			{
 | 
			
		||||
				OutHandSockets.Add(HandSocket);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return OutHandSockets.Num() > 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
UHandSocketComponent* UHandSocketComponent::GetClosestHandSocketComponentInRange(FVector SearchFromWorldLocation, float SearchRange)
 | 
			
		||||
{
 | 
			
		||||
	float SearchDistSq = FMath::Square(SearchRange);
 | 
			
		||||
	UHandSocketComponent* ClosestHandSocket = nullptr;
 | 
			
		||||
	float LastDist = 0.0f;
 | 
			
		||||
	float DistSq = 0.0f;
 | 
			
		||||
 | 
			
		||||
	bool bFoundOne = false;
 | 
			
		||||
	UHandSocketComponent* HandSocket = nullptr;
 | 
			
		||||
	FTransform HandSocketTrans;
 | 
			
		||||
	for (TObjectIterator<UHandSocketComponent> It; It; ++It)
 | 
			
		||||
	{
 | 
			
		||||
		HandSocket = *It;
 | 
			
		||||
		if (IsValid(HandSocket) && !HandSocket->IsTemplate())
 | 
			
		||||
		{
 | 
			
		||||
			HandSocketTrans = HandSocket->GetRelativeTransform() * HandSocket->GetOwner()->GetActorTransform();
 | 
			
		||||
			DistSq = FVector::DistSquared(HandSocketTrans.GetLocation(), SearchFromWorldLocation);
 | 
			
		||||
			if (DistSq <= SearchDistSq && (!bFoundOne || DistSq < LastDist))
 | 
			
		||||
			{
 | 
			
		||||
				bFoundOne = true;
 | 
			
		||||
				ClosestHandSocket = HandSocket;
 | 
			
		||||
				LastDist = DistSq;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return ClosestHandSocket;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool UHandSocketComponent::GetAnimationSequenceAsPoseSnapShot(UAnimSequence* InAnimationSequence, FPoseSnapshot& OutPoseSnapShot, USkeletalMeshComponent* TargetMesh, bool bSkipRootBone, bool bFlipHand)
 | 
			
		||||
{
 | 
			
		||||
	if (InAnimationSequence)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -677,8 +677,8 @@ void UVRLeverComponent::CalculateCurrentAngle(FTransform & CurrentTransform)
 | 
			
		|||
		FullCurrentAngle = FMath::RadiansToDegrees(FMath::Acos(FVector::DotProduct(UpVec, FVector::UpVector)));
 | 
			
		||||
		CurrentLeverAngle = FMath::RoundToFloat(FullCurrentAngle);
 | 
			
		||||
 | 
			
		||||
		AllCurrentLeverAngles.Roll = FMath::Sign(UpVec.Y) * FMath::RadiansToDegrees(FMath::Acos(FVector::DotProduct(FVector(0.0f, UpVec.Y, UpVec.Z), FVector::UpVector)));
 | 
			
		||||
		AllCurrentLeverAngles.Pitch = FMath::Sign(UpVec.X) * FMath::RadiansToDegrees(FMath::Acos(FVector::DotProduct(FVector(UpVec.X, 0.0f, UpVec.Z), FVector::UpVector)));
 | 
			
		||||
		AllCurrentLeverAngles.Roll = FMath::Sign(UpVec.Y) * FMath::RadiansToDegrees(FMath::Acos(FVector::DotProduct(FVector(0.0f, UpVec.Y, UpVec.Z).GetSafeNormal(), FVector::UpVector)));
 | 
			
		||||
		AllCurrentLeverAngles.Pitch = FMath::Sign(UpVec.X) * FMath::RadiansToDegrees(FMath::Acos(FVector::DotProduct(FVector(UpVec.X, 0.0f, UpVec.Z).GetSafeNormal(), FVector::UpVector)));
 | 
			
		||||
 | 
			
		||||
		if (bBlendAxisValuesByAngleThreshold)
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -50,7 +50,7 @@ void UParentRelativeAttachmentComponent::InitializeComponent()
 | 
			
		|||
	Super::InitializeComponent();
 | 
			
		||||
 | 
			
		||||
	// Update our tracking
 | 
			
		||||
	if (!bUseFeetLocation && IsValid(AttachChar)) // New case to early out and with less calculations
 | 
			
		||||
	if (!bUseFeetLocation && IsValid(AttachChar) && IsValid(AttachChar->VRReplicatedCamera)) // New case to early out and with less calculations
 | 
			
		||||
	{
 | 
			
		||||
		SetRelativeTransform(AttachChar->VRReplicatedCamera->GetRelativeTransform());
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -204,7 +204,7 @@ void UReplicatedVRCameraComponent::UpdateTracking(float DeltaTime)
 | 
			
		|||
					Position.Y = 0.0f;
 | 
			
		||||
 | 
			
		||||
					FRotator StoredCameraRotOffset = FRotator::ZeroRotator;
 | 
			
		||||
					if (AttachChar->VRMovementReference->GetReplicatedMovementMode() == EVRConjoinedMovementModes::C_VRMOVE_Seated)
 | 
			
		||||
					if (AttachChar->VRMovementReference && AttachChar->VRMovementReference->GetReplicatedMovementMode() == EVRConjoinedMovementModes::C_VRMOVE_Seated)
 | 
			
		||||
					{
 | 
			
		||||
						AttachChar->SeatInformation.InitialRelCameraTransform.Rotator();
 | 
			
		||||
					}
 | 
			
		||||
| 
						 | 
				
			
			@ -244,7 +244,7 @@ void UReplicatedVRCameraComponent::RunNetworkedSmoothing(float DeltaTime)
 | 
			
		|||
	if (AttachChar && !AttachChar->bRetainRoomscale)
 | 
			
		||||
	{
 | 
			
		||||
		FRotator StoredCameraRotOffset = FRotator::ZeroRotator;
 | 
			
		||||
		if (AttachChar->VRMovementReference->GetReplicatedMovementMode() == EVRConjoinedMovementModes::C_VRMOVE_Seated)
 | 
			
		||||
		if (AttachChar->VRMovementReference && AttachChar->VRMovementReference->GetReplicatedMovementMode() == EVRConjoinedMovementModes::C_VRMOVE_Seated)
 | 
			
		||||
		{
 | 
			
		||||
			AttachChar->SeatInformation.InitialRelCameraTransform.Rotator();
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -470,7 +470,7 @@ void UReplicatedVRCameraComponent::HandleXRCamera()
 | 
			
		|||
							Position.X = 0.0f;
 | 
			
		||||
							Position.Y = 0.0f;
 | 
			
		||||
							//FRotator OffsetRotator = 
 | 
			
		||||
							if (AttachChar->VRMovementReference->GetReplicatedMovementMode() != EVRConjoinedMovementModes::C_VRMOVE_Seated)
 | 
			
		||||
							if (AttachChar->VRMovementReference && AttachChar->VRMovementReference->GetReplicatedMovementMode() != EVRConjoinedMovementModes::C_VRMOVE_Seated)
 | 
			
		||||
							{
 | 
			
		||||
								AttachChar->SeatInformation.InitialRelCameraTransform.Rotator();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -521,7 +521,7 @@ void UReplicatedVRCameraComponent::OnRep_ReplicatedCameraTransform()
 | 
			
		|||
		CameraPosition.Y = 0;
 | 
			
		||||
 | 
			
		||||
		FRotator StoredCameraRotOffset = FRotator::ZeroRotator;
 | 
			
		||||
		if (AttachChar->VRMovementReference->GetReplicatedMovementMode() == EVRConjoinedMovementModes::C_VRMOVE_Seated)
 | 
			
		||||
		if (AttachChar->VRMovementReference && AttachChar->VRMovementReference->GetReplicatedMovementMode() == EVRConjoinedMovementModes::C_VRMOVE_Seated)
 | 
			
		||||
		{
 | 
			
		||||
			AttachChar->SeatInformation.InitialRelCameraTransform.Rotator();
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -54,7 +54,7 @@ AVRBaseCharacter::AVRBaseCharacter(const FObjectInitializer& ObjectInitializer)
 | 
			
		|||
		cap->SetCollisionResponseToChannel(ECollisionChannel::ECC_WorldStatic, ECollisionResponse::ECR_Block);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	NetSmoother = CreateDefaultSubobject<USceneComponent>(AVRBaseCharacter::SmoothingSceneParentComponentName);
 | 
			
		||||
	NetSmoother = CreateOptionalDefaultSubobject<USceneComponent>(AVRBaseCharacter::SmoothingSceneParentComponentName);
 | 
			
		||||
	if (NetSmoother)
 | 
			
		||||
	{
 | 
			
		||||
		NetSmoother->SetupAttachment(RootComponent);
 | 
			
		||||
| 
						 | 
				
			
			@ -69,17 +69,17 @@ AVRBaseCharacter::AVRBaseCharacter(const FObjectInitializer& ObjectInitializer)
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	VRProxyComponent = CreateDefaultSubobject<USceneComponent>(AVRBaseCharacter::VRProxyComponentName);
 | 
			
		||||
	VRProxyComponent = CreateOptionalDefaultSubobject<USceneComponent>(AVRBaseCharacter::VRProxyComponentName);
 | 
			
		||||
	if (NetSmoother && VRProxyComponent)
 | 
			
		||||
	{
 | 
			
		||||
		VRProxyComponent->SetupAttachment(NetSmoother);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	VRReplicatedCamera = CreateDefaultSubobject<UReplicatedVRCameraComponent>(AVRBaseCharacter::ReplicatedCameraComponentName);
 | 
			
		||||
	VRReplicatedCamera = CreateOptionalDefaultSubobject<UReplicatedVRCameraComponent>(AVRBaseCharacter::ReplicatedCameraComponentName);
 | 
			
		||||
	if (VRReplicatedCamera)
 | 
			
		||||
	{
 | 
			
		||||
		//VRReplicatedCamera->bOffsetByHMD = false;
 | 
			
		||||
		VRReplicatedCamera->SetupAttachment(VRProxyComponent);
 | 
			
		||||
		VRReplicatedCamera->SetupAttachment(VRProxyComponent ? VRProxyComponent : NetSmoother ? NetSmoother : RootComponent);
 | 
			
		||||
		VRReplicatedCamera->OverrideSendTransform = &AVRBaseCharacter::Server_SendTransformCamera;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -90,11 +90,11 @@ AVRBaseCharacter::AVRBaseCharacter(const FObjectInitializer& ObjectInitializer)
 | 
			
		|||
		//AddTickPrerequisiteComponent(this->GetCharacterMovement());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ParentRelativeAttachment = CreateDefaultSubobject<UParentRelativeAttachmentComponent>(AVRBaseCharacter::ParentRelativeAttachmentComponentName);
 | 
			
		||||
	ParentRelativeAttachment = CreateOptionalDefaultSubobject<UParentRelativeAttachmentComponent>(AVRBaseCharacter::ParentRelativeAttachmentComponentName);
 | 
			
		||||
	if (ParentRelativeAttachment && VRReplicatedCamera)
 | 
			
		||||
	{
 | 
			
		||||
		// Moved this to be root relative as the camera late updates were killing how it worked
 | 
			
		||||
		ParentRelativeAttachment->SetupAttachment(VRProxyComponent);
 | 
			
		||||
		ParentRelativeAttachment->SetupAttachment(VRProxyComponent ? VRProxyComponent : NetSmoother ? NetSmoother : RootComponent);
 | 
			
		||||
		//ParentRelativeAttachment->bOffsetByHMD = false;
 | 
			
		||||
		ParentRelativeAttachment->AddTickPrerequisiteComponent(VRReplicatedCamera);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -104,10 +104,10 @@ AVRBaseCharacter::AVRBaseCharacter(const FObjectInitializer& ObjectInitializer)
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	LeftMotionController = CreateDefaultSubobject<UGripMotionControllerComponent>(AVRBaseCharacter::LeftMotionControllerComponentName);
 | 
			
		||||
	LeftMotionController = CreateOptionalDefaultSubobject<UGripMotionControllerComponent>(AVRBaseCharacter::LeftMotionControllerComponentName);
 | 
			
		||||
	if (IsValid(LeftMotionController))
 | 
			
		||||
	{
 | 
			
		||||
		LeftMotionController->SetupAttachment(VRProxyComponent);
 | 
			
		||||
		LeftMotionController->SetupAttachment(VRProxyComponent ? VRProxyComponent : NetSmoother ? NetSmoother : RootComponent);
 | 
			
		||||
		//LeftMotionController->MotionSource = FXRMotionControllerBase::LeftHandSourceId;
 | 
			
		||||
		LeftMotionController->SetTrackingMotionSource(IMotionController::LeftHandSourceId);
 | 
			
		||||
		//LeftMotionController->Hand = EControllerHand::Left;
 | 
			
		||||
| 
						 | 
				
			
			@ -118,10 +118,10 @@ AVRBaseCharacter::AVRBaseCharacter(const FObjectInitializer& ObjectInitializer)
 | 
			
		|||
		LeftMotionController->OverrideSendTransform = &AVRBaseCharacter::Server_SendTransformLeftController;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	RightMotionController = CreateDefaultSubobject<UGripMotionControllerComponent>(AVRBaseCharacter::RightMotionControllerComponentName);
 | 
			
		||||
	RightMotionController = CreateOptionalDefaultSubobject<UGripMotionControllerComponent>(AVRBaseCharacter::RightMotionControllerComponentName);
 | 
			
		||||
	if (IsValid(RightMotionController))
 | 
			
		||||
	{
 | 
			
		||||
		RightMotionController->SetupAttachment(VRProxyComponent);
 | 
			
		||||
		RightMotionController->SetupAttachment(VRProxyComponent ? VRProxyComponent : NetSmoother ? NetSmoother : RootComponent);
 | 
			
		||||
		//RightMotionController->MotionSource = FXRMotionControllerBase::RightHandSourceId;
 | 
			
		||||
		RightMotionController->SetTrackingMotionSource(IMotionController::RightHandSourceId);
 | 
			
		||||
		//RightMotionController->Hand = EControllerHand::Right;
 | 
			
		||||
| 
						 | 
				
			
			@ -680,6 +680,9 @@ void AVRBaseCharacter::InitSeatedModeTransition()
 | 
			
		|||
 | 
			
		||||
void AVRBaseCharacter::TickSeatInformation(float DeltaTime)
 | 
			
		||||
{
 | 
			
		||||
	if (!VRReplicatedCamera)
 | 
			
		||||
		return;
 | 
			
		||||
	
 | 
			
		||||
	float LastThresholdScaler = SeatInformation.CurrentThresholdScaler;
 | 
			
		||||
	bool bLastOverThreshold = SeatInformation.bIsOverThreshold;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -779,7 +782,7 @@ bool AVRBaseCharacter::SetSeatedMode(USceneComponent * SeatParent, bool bSetSeat
 | 
			
		|||
 | 
			
		||||
		// Automate the intial relative camera transform for this mode
 | 
			
		||||
		// I think we can remove the initial value alltogether eventually right?
 | 
			
		||||
		if (!bRetainRoomscale)
 | 
			
		||||
		if (!bRetainRoomscale && VRReplicatedCamera)
 | 
			
		||||
		{
 | 
			
		||||
			InitialRelCameraTransform = FTransform(VRReplicatedCamera->ReplicatedCameraTransform.Rotation, VRReplicatedCamera->ReplicatedCameraTransform.Position, VRReplicatedCamera->GetComponentScale());
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -909,7 +912,7 @@ FVector AVRBaseCharacter::SetActorRotationVR(FRotator NewRot, bool bUseYawOnly,
 | 
			
		|||
		NewRot.Roll = 0.0f;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (bAccountForHMDRotation)
 | 
			
		||||
	if (bAccountForHMDRotation && VRReplicatedCamera)
 | 
			
		||||
	{
 | 
			
		||||
		NewRotation = UVRExpansionFunctionLibrary::GetHMDPureYaw_I(VRReplicatedCamera->GetRelativeRotation());
 | 
			
		||||
		NewRotation = (NewRot.Quaternion() * NewRotation.Quaternion().Inverse()).Rotator();
 | 
			
		||||
| 
						 | 
				
			
			@ -944,7 +947,7 @@ FVector AVRBaseCharacter::SetActorLocationAndRotationVR(FVector NewLoc, FRotator
 | 
			
		|||
		NewRot.Roll = 0.0f;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (bAccountForHMDRotation)
 | 
			
		||||
	if (bAccountForHMDRotation && VRReplicatedCamera)
 | 
			
		||||
	{
 | 
			
		||||
		NewRotation = UVRExpansionFunctionLibrary::GetHMDPureYaw_I(VRReplicatedCamera->GetRelativeRotation());//bUseControllerRotationYaw && OwningController ? OwningController->GetControlRotation() : GetActorRotation();
 | 
			
		||||
		NewRotation = (NewRot.Quaternion() * NewRotation.Quaternion().Inverse()).Rotator();
 | 
			
		||||
| 
						 | 
				
			
			@ -1201,4 +1204,4 @@ void AVRBaseCharacter::StopNavigationMovement()
 | 
			
		|||
		// not ignore OnRequestFinished notify that's going to be sent out due to this call
 | 
			
		||||
		pathComp->AbortMove(*this, FPathFollowingResultFlags::MovementStop | FPathFollowingResultFlags::ForcedScript);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2017,8 +2017,11 @@ void UVRBaseCharacterMovementComponent::SmoothCorrection(const FVector& OldLocat
 | 
			
		|||
			// I am currently skipping smoothing on rotation operations
 | 
			
		||||
			if ((!OldRotation.Equals(NewRotation, 1e-5f)))// || Velocity.IsNearlyZero()))
 | 
			
		||||
			{
 | 
			
		||||
				BaseVRCharacterOwner->NetSmoother->SetRelativeLocation(BaseVRCharacterOwner->bRetainRoomscale ? FVector::ZeroVector : BaseVRCharacterOwner->VRRootReference->GetTargetHeightOffset());			
 | 
			
		||||
				//BaseVRCharacterOwner->NetSmoother->SetRelativeLocation(FVector::ZeroVector);
 | 
			
		||||
				if (BaseVRCharacterOwner->NetSmoother)
 | 
			
		||||
				{
 | 
			
		||||
					BaseVRCharacterOwner->NetSmoother->SetRelativeLocation(BaseVRCharacterOwner->bRetainRoomscale ? FVector::ZeroVector : BaseVRCharacterOwner->VRRootReference->GetTargetHeightOffset());			
 | 
			
		||||
					//BaseVRCharacterOwner->NetSmoother->SetRelativeLocation(FVector::ZeroVector);
 | 
			
		||||
				}
 | 
			
		||||
				UpdatedComponent->SetWorldLocationAndRotation(NewLocation, NewRotation, false, nullptr, GetTeleportType());
 | 
			
		||||
				ClientData->MeshTranslationOffset = FVector::ZeroVector;
 | 
			
		||||
				ClientData->MeshRotationOffset = ClientData->MeshRotationTarget;
 | 
			
		||||
| 
						 | 
				
			
			@ -2152,7 +2155,7 @@ void UVRBaseCharacterMovementComponent::SmoothClientPosition_UpdateVRVisuals()
 | 
			
		|||
 | 
			
		||||
	if (ClientData)
 | 
			
		||||
	{
 | 
			
		||||
		if (NetworkSmoothingMode == ENetworkSmoothingMode::Linear)
 | 
			
		||||
		if (NetworkSmoothingMode == ENetworkSmoothingMode::Linear && BaseVRCharacterOwner->NetSmoother)
 | 
			
		||||
		{
 | 
			
		||||
			// Erased most of the code here, check back in later
 | 
			
		||||
			const USceneComponent* MeshParent = BaseVRCharacterOwner->NetSmoother->GetAttachParent();
 | 
			
		||||
| 
						 | 
				
			
			@ -2167,7 +2170,7 @@ void UVRBaseCharacterMovementComponent::SmoothClientPosition_UpdateVRVisuals()
 | 
			
		|||
			FVector HeightOffset = (BaseVRCharacterOwner->bRetainRoomscale ? FVector::ZeroVector : BaseVRCharacterOwner->VRRootReference->GetTargetHeightOffset());
 | 
			
		||||
			BaseVRCharacterOwner->NetSmoother->SetRelativeLocation(NewRelLocation + HeightOffset);
 | 
			
		||||
		}
 | 
			
		||||
		else if (NetworkSmoothingMode == ENetworkSmoothingMode::Exponential)
 | 
			
		||||
		else if (NetworkSmoothingMode == ENetworkSmoothingMode::Exponential && BaseVRCharacterOwner->NetSmoother)
 | 
			
		||||
		{
 | 
			
		||||
			const USceneComponent* MeshParent = BaseVRCharacterOwner->NetSmoother->GetAttachParent();
 | 
			
		||||
			FVector MeshParentScale = MeshParent != nullptr ? MeshParent->GetComponentScale() : FVector(1.0f, 1.0f, 1.0f);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -423,11 +423,14 @@ void UVRRootComponent::BeginPlay()
 | 
			
		|||
	Super::BeginPlay();
 | 
			
		||||
 | 
			
		||||
	if(AVRBaseCharacter * vrOwner = Cast<AVRBaseCharacter>(this->GetOwner()))
 | 
			
		||||
	{ 
 | 
			
		||||
		TargetPrimitiveComponent = vrOwner->VRReplicatedCamera;
 | 
			
		||||
		owningVRChar = vrOwner;
 | 
			
		||||
		//VRCameraCollider = vrOwner->VRCameraCollider;
 | 
			
		||||
		return;
 | 
			
		||||
	{
 | 
			
		||||
		if (vrOwner->VRReplicatedCamera)
 | 
			
		||||
		{
 | 
			
		||||
			TargetPrimitiveComponent = vrOwner->VRReplicatedCamera;
 | 
			
		||||
			owningVRChar = vrOwner;
 | 
			
		||||
			//VRCameraCollider = vrOwner->VRCameraCollider;
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			@ -456,7 +459,7 @@ void UVRRootComponent::SetTrackingPaused(bool bPaused)
 | 
			
		|||
 | 
			
		||||
void UVRRootComponent::UpdateCharacterCapsuleOffset()
 | 
			
		||||
{
 | 
			
		||||
	if (owningVRChar && !owningVRChar->bRetainRoomscale)
 | 
			
		||||
	if (owningVRChar && !owningVRChar->bRetainRoomscale && owningVRChar->NetSmoother)
 | 
			
		||||
	{
 | 
			
		||||
		if (!FMath::IsNearlyEqual(LastCapsuleHalfHeight, CapsuleHalfHeight))
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			@ -485,11 +488,13 @@ void UVRRootComponent::TickComponent(float DeltaTime, enum ELevelTick TickType,
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	UVRBaseCharacterMovementComponent * CharMove = nullptr;
 | 
			
		||||
	bool bRetainRoomscale = true;
 | 
			
		||||
 | 
			
		||||
	// Need these for passing physics updates to character movement
 | 
			
		||||
	if (IsValid(owningVRChar))
 | 
			
		||||
	{
 | 
			
		||||
		CharMove = Cast<UVRBaseCharacterMovementComponent>(owningVRChar->GetCharacterMovement());
 | 
			
		||||
		bRetainRoomscale = owningVRChar->bRetainRoomscale;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (IsLocallyControlled())
 | 
			
		||||
| 
						 | 
				
			
			@ -539,7 +544,7 @@ void UVRRootComponent::TickComponent(float DeltaTime, enum ELevelTick TickType,
 | 
			
		|||
 | 
			
		||||
		// Skip this if not retaining roomscale as we use higher initial fidelity
 | 
			
		||||
		// And we can rep the values at full precision if we want too
 | 
			
		||||
		if (owningVRChar->bRetainRoomscale)
 | 
			
		||||
		if (bRetainRoomscale)
 | 
			
		||||
		{
 | 
			
		||||
			// Pre-Process this for network sends
 | 
			
		||||
			curCameraLoc.X = FMath::RoundToFloat(curCameraLoc.X * 100.f) / 100.f;
 | 
			
		||||
| 
						 | 
				
			
			@ -549,14 +554,14 @@ void UVRRootComponent::TickComponent(float DeltaTime, enum ELevelTick TickType,
 | 
			
		|||
		
 | 
			
		||||
 | 
			
		||||
		// Can adjust the relative tolerances to remove jitter and some update processing
 | 
			
		||||
		if (!owningVRChar->bRetainRoomscale || (!curCameraLoc.Equals(lastCameraLoc, 0.01f) || !curCameraRot.Equals(lastCameraRot, 0.01f)))
 | 
			
		||||
		if (!bRetainRoomscale || (!curCameraLoc.Equals(lastCameraLoc, 0.01f) || !curCameraRot.Equals(lastCameraRot, 0.01f)))
 | 
			
		||||
		{
 | 
			
		||||
			// Also calculate vector of movement for the movement component
 | 
			
		||||
			FVector LastPosition = OffsetComponentToWorld.GetLocation();
 | 
			
		||||
 | 
			
		||||
			bCalledUpdateTransform = false;
 | 
			
		||||
 | 
			
		||||
			if (owningVRChar->bRetainRoomscale)
 | 
			
		||||
			if (bRetainRoomscale)
 | 
			
		||||
			{
 | 
			
		||||
				// If the character movement doesn't exist or is not active/ticking
 | 
			
		||||
				if (!CharMove || !CharMove->IsComponentTickEnabled() || !CharMove->IsActive())
 | 
			
		||||
| 
						 | 
				
			
			@ -578,7 +583,7 @@ void UVRRootComponent::TickComponent(float DeltaTime, enum ELevelTick TickType,
 | 
			
		|||
			Params.bFindInitialOverlaps = true;
 | 
			
		||||
			bool bBlockingHit = false;
 | 
			
		||||
 | 
			
		||||
			if (bUseWalkingCollisionOverride && owningVRChar->bRetainRoomscale)
 | 
			
		||||
			if (bUseWalkingCollisionOverride && bRetainRoomscale)
 | 
			
		||||
			{
 | 
			
		||||
				FVector TargetWorldLocation = OffsetComponentToWorld.GetLocation();
 | 
			
		||||
				bool bAllowWalkingCollision = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -608,9 +613,9 @@ void UVRRootComponent::TickComponent(float DeltaTime, enum ELevelTick TickType,
 | 
			
		|||
				bHadRelativeMovement = true;
 | 
			
		||||
 | 
			
		||||
			// Not supporting walking collision override currently with new pawn setup
 | 
			
		||||
			if (bHadRelativeMovement || !owningVRChar->bRetainRoomscale)
 | 
			
		||||
			if (bHadRelativeMovement || (owningVRChar && !owningVRChar->bRetainRoomscale))
 | 
			
		||||
			{
 | 
			
		||||
				if (owningVRChar->bRetainRoomscale)
 | 
			
		||||
				if (bRetainRoomscale)
 | 
			
		||||
				{
 | 
			
		||||
					DifferenceFromLastFrame = OffsetComponentToWorld.GetLocation() - LastPosition;
 | 
			
		||||
					lastCameraLoc = curCameraLoc;
 | 
			
		||||
| 
						 | 
				
			
			@ -756,7 +761,10 @@ void UVRRootComponent::SetSimulatePhysics(bool bSimulate)
 | 
			
		|||
	{
 | 
			
		||||
		if (AVRCharacter* OwningCharacter = Cast<AVRCharacter>(GetOwner()))
 | 
			
		||||
		{
 | 
			
		||||
			OwningCharacter->NetSmoother->SetRelativeLocation(FVector(0.f,0.f, -this->GetUnscaledCapsuleHalfHeight()));
 | 
			
		||||
			if (OwningCharacter->NetSmoother)
 | 
			
		||||
			{
 | 
			
		||||
				OwningCharacter->NetSmoother->SetRelativeLocation(FVector(0.f,0.f, -this->GetUnscaledCapsuleHalfHeight()));
 | 
			
		||||
			}
 | 
			
		||||
		}	
 | 
			
		||||
		this->AddWorldOffset(this->GetComponentRotation().RotateVector(FVector(0.f, 0.f, this->GetScaledCapsuleHalfHeight())), false, nullptr, ETeleportType::TeleportPhysics);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -764,7 +772,10 @@ void UVRRootComponent::SetSimulatePhysics(bool bSimulate)
 | 
			
		|||
	{
 | 
			
		||||
		if (AVRCharacter* OwningCharacter = Cast<AVRCharacter>(GetOwner()))
 | 
			
		||||
		{
 | 
			
		||||
			OwningCharacter->NetSmoother->SetRelativeLocation(FVector(0.f, 0.f, 0));
 | 
			
		||||
			if (OwningCharacter->NetSmoother)
 | 
			
		||||
			{
 | 
			
		||||
				OwningCharacter->NetSmoother->SetRelativeLocation(FVector(0.f, 0.f, 0));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		this->AddWorldOffset(this->GetComponentRotation().RotateVector(FVector(0.f, 0.f, -this->GetScaledCapsuleHalfHeight())), false, nullptr, ETeleportType::TeleportPhysics);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -576,28 +576,31 @@ void UVRStereoWidgetComponent::TickComponent(float DeltaTime, enum ELevelTick Ti
 | 
			
		|||
					bool bHandledTransform = false;
 | 
			
		||||
					if (AVRBaseCharacter* BaseVRChar = Cast<AVRBaseCharacter>(mpawn))
 | 
			
		||||
					{
 | 
			
		||||
						if (USceneComponent* CameraParent = BaseVRChar->VRReplicatedCamera->GetAttachParent())
 | 
			
		||||
						if (BaseVRChar->VRReplicatedCamera)
 | 
			
		||||
						{
 | 
			
		||||
							FTransform DeltaTrans = FTransform::Identity;
 | 
			
		||||
							if (!BaseVRChar->bRetainRoomscale)
 | 
			
		||||
							if (USceneComponent* CameraParent = BaseVRChar->VRReplicatedCamera->GetAttachParent())
 | 
			
		||||
							{
 | 
			
		||||
								FVector HMDLoc;
 | 
			
		||||
								FQuat HMDRot;
 | 
			
		||||
								GEngine->XRSystem->GetCurrentPose(IXRTrackingSystem::HMDDeviceId, HMDRot, HMDLoc);
 | 
			
		||||
 | 
			
		||||
								HMDLoc.Z = 0.0f;
 | 
			
		||||
 | 
			
		||||
								if (AVRCharacter* VRChar = Cast<AVRCharacter>(mpawn))
 | 
			
		||||
								FTransform DeltaTrans = FTransform::Identity;
 | 
			
		||||
								if (!BaseVRChar->bRetainRoomscale)
 | 
			
		||||
								{
 | 
			
		||||
									HMDLoc += UVRExpansionFunctionLibrary::GetHMDPureYaw_I(HMDRot.Rotator()).RotateVector(FVector(VRChar->VRRootReference->VRCapsuleOffset.X, VRChar->VRRootReference->VRCapsuleOffset.Y, 0.0f));
 | 
			
		||||
									FVector HMDLoc;
 | 
			
		||||
									FQuat HMDRot;
 | 
			
		||||
									GEngine->XRSystem->GetCurrentPose(IXRTrackingSystem::HMDDeviceId, HMDRot, HMDLoc);
 | 
			
		||||
 | 
			
		||||
									HMDLoc.Z = 0.0f;
 | 
			
		||||
 | 
			
		||||
									if (AVRCharacter* VRChar = Cast<AVRCharacter>(mpawn))
 | 
			
		||||
									{
 | 
			
		||||
										HMDLoc += UVRExpansionFunctionLibrary::GetHMDPureYaw_I(HMDRot.Rotator()).RotateVector(FVector(VRChar->VRRootReference->VRCapsuleOffset.X, VRChar->VRRootReference->VRCapsuleOffset.Y, 0.0f));
 | 
			
		||||
									}
 | 
			
		||||
 | 
			
		||||
									DeltaTrans = FTransform(FQuat::Identity, HMDLoc, FVector(1.0f));
 | 
			
		||||
								}
 | 
			
		||||
 | 
			
		||||
								DeltaTrans = FTransform(FQuat::Identity, HMDLoc, FVector(1.0f));
 | 
			
		||||
								Transform = OffsetTransform.GetRelativeTransform(CameraParent->GetComponentTransform());
 | 
			
		||||
								Transform = (FTransform(FRotator(0.f, -180.f, 0.f)) * Transform) * DeltaTrans;
 | 
			
		||||
								bHandledTransform = true;
 | 
			
		||||
							}
 | 
			
		||||
 | 
			
		||||
							Transform = OffsetTransform.GetRelativeTransform(CameraParent->GetComponentTransform());
 | 
			
		||||
							Transform = (FTransform(FRotator(0.f, -180.f, 0.f)) * Transform) * DeltaTrans;
 | 
			
		||||
							bHandledTransform = true;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
					else if (UCameraComponent* Camera = mpawn->FindComponentByClass<UCameraComponent>())
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,6 +55,27 @@ public:
 | 
			
		|||
	UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "GSSettings")
 | 
			
		||||
	bool bIsActive;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	// If we should replicate, if false we will never be added to our parents list.
 | 
			
		||||
	UPROPERTY(Replicated, EditDefaultsOnly, BlueprintReadOnly, Category = "GSSettings|Replication", meta = (AllowPrivateAccess = "true"))
 | 
			
		||||
	bool bReplicates = false;
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
	/** Enable or disable replication. This is the equivalent of RemoteRole for actors (only a bool is required for components) */
 | 
			
		||||
	UFUNCTION(BlueprintCallable, Category = "Components")
 | 
			
		||||
		void SetIsReplicated(bool ShouldReplicate);
 | 
			
		||||
 | 
			
		||||
	/** Returns whether replication is enabled or not. */
 | 
			
		||||
	UFUNCTION(BlueprintCallable, Category = "Components")
 | 
			
		||||
	bool GetIsReplicated() const
 | 
			
		||||
	{
 | 
			
		||||
		return bReplicates;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Replication Condition (If using subobject replication list)
 | 
			
		||||
	UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "GSSettings|Replication")
 | 
			
		||||
	TEnumAsByte<ELifetimeCondition> ReplicationCondition = ELifetimeCondition::COND_None;
 | 
			
		||||
 | 
			
		||||
	// Returns if the script is going to modify the world transform of the grip
 | 
			
		||||
	EGSTransformOverrideType GetWorldTransformOverrideType();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -128,8 +149,13 @@ public:
 | 
			
		|||
	bool Wants_DenyTeleport(UGripMotionControllerComponent * Controller);
 | 
			
		||||
	virtual bool Wants_DenyTeleport_Implementation(UGripMotionControllerComponent* Controller);
 | 
			
		||||
 | 
			
		||||
#if UE_WITH_IRIS
 | 
			
		||||
	/** Register all replication fragments */
 | 
			
		||||
	virtual void RegisterReplicationFragments(UE::Net::FFragmentRegistrationContext& Context, UE::Net::EFragmentRegistrationFlags RegistrationFlags) override;
 | 
			
		||||
#endif // UE_WITH_IRIS
 | 
			
		||||
 | 
			
		||||
	virtual void GetLifetimeReplicatedProps(TArray< class FLifetimeProperty > & OutLifetimeProps) const override;
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	// doesn't currently compile in editor builds, not sure why the linker is screwing up there but works elsewhere
 | 
			
		||||
	//virtual void PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker);
 | 
			
		||||
	virtual bool CallRemoteFunction(UFunction * Function, void * Parms, FOutParmRec * OutParms, FFrame * Stack) override;
 | 
			
		||||
| 
						 | 
				
			
			@ -200,6 +226,7 @@ public:
 | 
			
		|||
	UFUNCTION(BlueprintPure, Category = "VRGripScript")
 | 
			
		||||
		bool IsServer();
 | 
			
		||||
 | 
			
		||||
	virtual void BeginDestroy();
 | 
			
		||||
	void EndPlay(const EEndPlayReason::Type EndPlayReason);
 | 
			
		||||
 | 
			
		||||
	// Not all scripts will require this function, specific ones that use things like Lever logic however will. Best to call it.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -161,10 +161,10 @@ public:
 | 
			
		|||
		bool bDisabled;
 | 
			
		||||
 | 
			
		||||
	/*** 
 | 
			
		||||
	/*	If true then the hand socket will be locked in place during gameplay and not moved with the actor (saving performance)
 | 
			
		||||
	/*  Generally you want this unless you are moving a hand socket manually during play for custom grip offsetting logic
 | 
			
		||||
	/*  If you need the relative location of the hand socket for game logic, get the LockedRelativeTransform variable if bLockInPlace is enabled.
 | 
			
		||||
	/*  Defaulted off currently for bug testing
 | 
			
		||||
	//	If true then the hand socket will be locked in place during gameplay and not moved with the actor (saving performance)
 | 
			
		||||
	//  Generally you want this unless you are moving a hand socket manually during play for custom grip offsetting logic
 | 
			
		||||
	//  If you need the relative location of the hand socket for game logic, get the LockedRelativeTransform variable if bLockInPlace is enabled.
 | 
			
		||||
	//  Defaulted off currently for bug testing
 | 
			
		||||
	***/
 | 
			
		||||
	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Hand Socket Data|Control")
 | 
			
		||||
		bool bLockInPlace;
 | 
			
		||||
| 
						 | 
				
			
			@ -232,6 +232,26 @@ public:
 | 
			
		|||
	UFUNCTION(BlueprintCallable, Category = "Hand Socket Data", meta = (bIgnoreSelf = "true"))
 | 
			
		||||
		static bool GetAnimationSequenceAsPoseSnapShot(UAnimSequence * InAnimationSequence, FPoseSnapshot& OutPoseSnapShot, USkeletalMeshComponent* TargetMesh = nullptr, bool bSkipRootBone = false, bool bFlipHand = false);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	* Gets all hand socket components in the entire level (this is a slow operation, DO NOT run this on tick)
 | 
			
		||||
	*/
 | 
			
		||||
	UFUNCTION(BlueprintCallable, Category = "Hand Socket Data")
 | 
			
		||||
		static void GetAllHandSocketComponents(TArray<UHandSocketComponent*>& OutHandSockets);
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	* Gets all hand socket components within a set range of a world location (this is a slow operation, DO NOT run this on tick)
 | 
			
		||||
	*/
 | 
			
		||||
	UFUNCTION(BlueprintCallable, Category = "Hand Socket Data")
 | 
			
		||||
		static bool GetAllHandSocketComponentsInRange(FVector SearchFromWorldLocation, float SearchRange, TArray<UHandSocketComponent*>& OutHandSockets);
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	* Gets the closest hand socket component within a set range of a world location (this is a slow operation, DO NOT run this on tick)
 | 
			
		||||
	* Must check the output for validity
 | 
			
		||||
	*/
 | 
			
		||||
	UFUNCTION(BlueprintCallable, Category = "Hand Socket Data")
 | 
			
		||||
		static UHandSocketComponent* GetClosestHandSocketComponentInRange(FVector SearchFromWorldLocation, float SearchRange);
 | 
			
		||||
 | 
			
		||||
	// Returns the target relative transform of the hand
 | 
			
		||||
	//UFUNCTION(BlueprintCallable, Category = "Hand Socket Data")
 | 
			
		||||
	FTransform GetHandRelativePlacement();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -108,7 +108,7 @@ protected:
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
	void BeginPlay() override;
 | 
			
		||||
	virtual void BeginPlay() override;
 | 
			
		||||
	virtual void InitializeComponent() override;
 | 
			
		||||
 | 
			
		||||
	bool IsLocallyControlled() const;
 | 
			
		||||
| 
						 | 
				
			
			@ -200,7 +200,7 @@ public:
 | 
			
		|||
	bool bHadRelativeMovement;
 | 
			
		||||
 | 
			
		||||
	FPrimitiveSceneProxy* CreateSceneProxy() override;
 | 
			
		||||
	void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
 | 
			
		||||
	virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
 | 
			
		||||
 | 
			
		||||
	virtual void UpdatePhysicsVolume(bool bTriggerNotifiers) override;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,6 +15,7 @@ public class VRExpansionPlugin : ModuleRules
 | 
			
		|||
        //bEnforceIWYU = true;
 | 
			
		||||
 | 
			
		||||
        PublicDefinitions.Add("WITH_VR_EXPANSION=1");
 | 
			
		||||
        SetupIrisSupport(Target);
 | 
			
		||||
 | 
			
		||||
        // To detect VR Preview, not built out in packaged builds
 | 
			
		||||
        if (Target.bBuildEditor == true)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue