Work on Inventory (Stacking seems to work now), Update Dependencies
This commit is contained in:
		
							parent
							
								
									f6c05d68e3
								
							
						
					
					
						commit
						fdb352ddf1
					
				
					 29 changed files with 224 additions and 184 deletions
				
			
		
							
								
								
									
										
											BIN
										
									
								
								VIRTUOS_ExpansionPluginTests/Content/Inventory/BP_InventoryWidget.uasset
									 (Stored with Git LFS)
										
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								VIRTUOS_ExpansionPluginTests/Content/Inventory/BP_InventoryWidget.uasset
									 (Stored with Git LFS)
										
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								VIRTUOS_ExpansionPluginTests/Content/Inventory/BP_VRInventory.uasset
									 (Stored with Git LFS)
										
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								VIRTUOS_ExpansionPluginTests/Content/Inventory/BP_VRInventory.uasset
									 (Stored with Git LFS)
										
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								VIRTUOS_ExpansionPluginTests/Content/Inventory/InventoryDataTable.uasset
									 (Stored with Git LFS)
										
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								VIRTUOS_ExpansionPluginTests/Content/Inventory/InventoryDataTable.uasset
									 (Stored with Git LFS)
										
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								VIRTUOS_ExpansionPluginTests/Content/UIMaterialLab/Materials/6_Patterns/4_Halftone/M_UI_Halftone.uasset
									 (Stored with Git LFS)
										
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								VIRTUOS_ExpansionPluginTests/Content/UIMaterialLab/Materials/6_Patterns/4_Halftone/M_UI_Halftone.uasset
									 (Stored with Git LFS)
										
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								VIRTUOS_ExpansionPluginTests/Content/VRE/Core/Character/BP_Trace_Controller.uasset
									 (Stored with Git LFS)
										
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								VIRTUOS_ExpansionPluginTests/Content/VRE/Core/Character/BP_Trace_Controller.uasset
									 (Stored with Git LFS)
										
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								VIRTUOS_ExpansionPluginTests/Content/VRE/Core/Character/BP_VRCharacter.uasset
									 (Stored with Git LFS)
										
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								VIRTUOS_ExpansionPluginTests/Content/VRE/Core/Character/BP_VRCharacter.uasset
									 (Stored with Git LFS)
										
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								VIRTUOS_ExpansionPluginTests/Content/VRE/ExampleMap/MotionControllerMap.umap
									 (Stored with Git LFS)
										
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								VIRTUOS_ExpansionPluginTests/Content/VRE/ExampleMap/MotionControllerMap.umap
									 (Stored with Git LFS)
										
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								VIRTUOS_ExpansionPluginTests/Content/VRE/Grippables/Weapons/Guns/GunBase.uasset
									 (Stored with Git LFS)
										
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								VIRTUOS_ExpansionPluginTests/Content/VRE/Grippables/Weapons/Guns/GunBase.uasset
									 (Stored with Git LFS)
										
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -1 +1 @@
 | 
			
		|||
Subproject commit 2c50d98d0de49b79602a30397dbda089b672c3b6
 | 
			
		||||
Subproject commit 006e2b4922eb4f7af0d6df1468a042a98eecf68f
 | 
			
		||||
| 
						 | 
				
			
			@ -37,7 +37,12 @@
 | 
			
		|||
	"Plugins": [
 | 
			
		||||
		{
 | 
			
		||||
			"Name": "OpenXR",
 | 
			
		||||
			"Enabled": true
 | 
			
		||||
			"Enabled": true,
 | 
			
		||||
			"PlatformAllowList": [
 | 
			
		||||
			"Win64",
 | 
			
		||||
			"Linux",
 | 
			
		||||
			"Android"
 | 
			
		||||
     ]
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			"Name": "XRBase",
 | 
			
		||||
| 
						 | 
				
			
			@ -45,3 +50,4 @@
 | 
			
		|||
		}
 | 
			
		||||
	]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -51,7 +51,7 @@ namespace UnrealBuildTool.Rules
 | 
			
		|||
                }
 | 
			
		||||
				);
 | 
			
		||||
                
 | 
			
		||||
            if (Target.Platform != UnrealTargetPlatform.Mac)
 | 
			
		||||
            if (Target.Platform != UnrealTargetPlatform.Mac && Target.Platform != UnrealTargetPlatform.IOS)
 | 
			
		||||
            {
 | 
			
		||||
                PrivateDependencyModuleNames.AddRange(
 | 
			
		||||
                    new string[]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -107,7 +107,7 @@ TWeakObjectPtr<UAnimSequence> FHandSocketComponentDetails::SaveAnimationAsset(co
 | 
			
		|||
 | 
			
		||||
	if (!BaseAnimation)
 | 
			
		||||
	{
 | 
			
		||||
		LocalPoses = HandSocketComponent->VisualizationMesh->GetSkeleton()->GetRefLocalPoses();
 | 
			
		||||
		LocalPoses = HandSocketComponent->VisualizationMesh->GetRefSkeleton().GetRefBonePose();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// If not, create new one now.
 | 
			
		||||
| 
						 | 
				
			
			@ -251,7 +251,7 @@ TWeakObjectPtr<UAnimSequence> FHandSocketComponentDetails::SaveAnimationAsset(co
 | 
			
		|||
						int32 BoneIndex = BoneTreeIndex;//AnimSkeleton->GetMeshBoneIndexFromSkeletonBoneIndex(SkeletalMesh, BoneTreeIndex);
 | 
			
		||||
						//int32 ParentIndex = SkeletalMesh->RefSkeleton.GetParentIndex(BoneIndex);
 | 
			
		||||
						FTransform LocalTransform = LocalPoses[BoneIndex];
 | 
			
		||||
 | 
			
		||||
						//FTransform LocalTransform = RefSkeleton.GetRefBonePose()[BoneIndex];
 | 
			
		||||
 | 
			
		||||
						FName BoneName = AnimSkeleton->GetReferenceSkeleton().GetBoneName(BoneIndex);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -75,6 +75,9 @@ void UGS_Melee::UpdateDualHandInfo()
 | 
			
		|||
	{
 | 
			
		||||
		if (NumControllers > 1)
 | 
			
		||||
		{
 | 
			
		||||
			if (!Grip.IsValid())
 | 
			
		||||
				continue;
 | 
			
		||||
 | 
			
		||||
			FBPActorGripInformation* GripInfo = Grip.HoldingController->GetGripPtrByID(Grip.GripID);
 | 
			
		||||
			if (GripInfo)
 | 
			
		||||
			{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,7 +9,7 @@
 | 
			
		|||
#include UE_INLINE_GENERATED_CPP_BY_NAME(GrippablePhysicsReplication)
 | 
			
		||||
 | 
			
		||||
#include "CoreMinimal.h"
 | 
			
		||||
#include "PhysicsEngine\BodyInstance.h"
 | 
			
		||||
#include "PhysicsEngine/BodyInstance.h"
 | 
			
		||||
#include "Components/PrimitiveComponent.h"
 | 
			
		||||
#include "Components/SkeletalMeshComponent.h"
 | 
			
		||||
#include "UObject/ObjectMacros.h"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,6 +19,7 @@
 | 
			
		|||
#include "GripMotionControllerComponent.h"
 | 
			
		||||
//#include "VRGripInterface.h"
 | 
			
		||||
//#include "VRBPDatatypes.h"
 | 
			
		||||
#include "Engine/SkinnedAssetCommon.h"
 | 
			
		||||
#include "Net/UnrealNetwork.h"
 | 
			
		||||
#include "Serialization/CustomVersion.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -396,7 +397,8 @@ bool UHandSocketComponent::GetBlendedPoseSnapShot(FPoseSnapshot& PoseSnapShot, U
 | 
			
		|||
		PoseSnapShot.LocalTransforms.Empty();
 | 
			
		||||
		TargetMesh->GetBoneNames(PoseSnapShot.BoneNames);
 | 
			
		||||
 | 
			
		||||
		PoseSnapShot.LocalTransforms = TargetMesh->GetSkinnedAsset()->GetSkeleton()->GetRefLocalPoses();
 | 
			
		||||
		//PoseSnapShot.LocalTransforms = TargetMesh->GetSkinnedAsset()->GetSkeleton()->GetRefLocalPoses();
 | 
			
		||||
		PoseSnapShot.LocalTransforms = TargetMesh->GetSkinnedAsset()->GetRefSkeleton().GetRefBonePose();
 | 
			
		||||
 | 
			
		||||
		FQuat DeltaQuat = FQuat::Identity;
 | 
			
		||||
		FName TargetBoneName = NAME_None;
 | 
			
		||||
| 
						 | 
				
			
			@ -781,9 +783,11 @@ void UHandSocketComponent::PoseVisualizationToAnimation(bool bForceRefresh)
 | 
			
		|||
	if (!HandTargetAnimation)
 | 
			
		||||
	{
 | 
			
		||||
		// Store local poses for posing
 | 
			
		||||
		LocalPoses = HandVisualizerComponent->GetSkinnedAsset()->GetSkeleton()->GetRefLocalPoses();
 | 
			
		||||
		LocalPoses = HandVisualizerComponent->GetSkinnedAsset()->GetRefSkeleton().GetRefBonePose();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	// Check out of the skin cache, the poses don't update otherwise when enabled
 | 
			
		||||
	int32 NumLODs = HandVisualizerComponent->GetNumLODs();
 | 
			
		||||
	HandVisualizerComponent->SkinCacheUsage.Empty(NumLODs);
 | 
			
		||||
| 
						 | 
				
			
			@ -840,6 +844,7 @@ void UHandSocketComponent::PoseVisualizationToAnimation(bool bForceRefresh)
 | 
			
		|||
		else
 | 
			
		||||
		{
 | 
			
		||||
			BoneTrans = LocalPoses[i];
 | 
			
		||||
			//BoneTrans = HandVisualizerComponent->GetSkinnedAsset()->GetRefSkeleton().GetRefBonePose()[i];
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		BoneTrans = BoneTrans * ParentTrans;// *HandVisualizerComponent->GetComponentTransform();
 | 
			
		||||
| 
						 | 
				
			
			@ -850,7 +855,6 @@ void UHandSocketComponent::PoseVisualizationToAnimation(bool bForceRefresh)
 | 
			
		|||
		BoneTrans.ConcatenateRotation(DeltaQuat);
 | 
			
		||||
		BoneTrans.NormalizeRotation();
 | 
			
		||||
		HandVisualizerComponent->SetBoneTransformByName(BonesNames[i], BoneTrans, EBoneSpaces::ComponentSpace);
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (HandVisualizerComponent && (!bTickedPose || bForceRefresh))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -278,18 +278,28 @@ void UVRDialComponent::OnGripRelease_Implementation(UGripMotionControllerCompone
 | 
			
		|||
			{
 | 
			
		||||
				this->SetRelativeRotation((FTransform(UVRInteractibleFunctionLibrary::SetAxisValueRot(DialRotationAxis, FMath::GridSnap(CurRotBackEnd, SnapAngleIncrement), FRotator::ZeroRotator)) * InitialRelativeTransform).Rotator());
 | 
			
		||||
				CurRotBackEnd = FMath::GridSnap(CurRotBackEnd, SnapAngleIncrement);
 | 
			
		||||
				
 | 
			
		||||
				if (bUseRollover)
 | 
			
		||||
				{
 | 
			
		||||
					CurrentDialAngle = FMath::RoundToFloat(CurRotBackEnd);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					CurrentDialAngle = FRotator::ClampAxis(FMath::RoundToFloat(CurRotBackEnd));
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				// Reset to the snap angle so that it requires full motion to break out of it
 | 
			
		||||
				CurRotBackEnd = CurrentDialAngle;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (bUseRollover)
 | 
			
		||||
		{
 | 
			
		||||
			CurrentDialAngle = FMath::RoundToFloat(CurRotBackEnd);
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			CurrentDialAngle = FRotator::ClampAxis(FMath::RoundToFloat(CurRotBackEnd));
 | 
			
		||||
			// Reset to the snap angle so that it requires full motion to break out of it
 | 
			
		||||
			CurRotBackEnd = CurrentDialAngle;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
		if (!FMath::IsNearlyEqual(LastSnapAngle, CurrentDialAngle))
 | 
			
		||||
		{
 | 
			
		||||
			ReceiveDialHitSnapAngle(CurrentDialAngle);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,143 @@
 | 
			
		|||
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
 | 
			
		||||
 | 
			
		||||
#include "Misc/VRGameViewportClient.h"
 | 
			
		||||
#include UE_INLINE_GENERATED_CPP_BY_NAME(VRGameViewportClient)
 | 
			
		||||
 | 
			
		||||
#include "CoreMinimal.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
UVRGameViewportClient::UVRGameViewportClient(const FObjectInitializer& ObjectInitializer)
 | 
			
		||||
	: Super(ObjectInitializer)
 | 
			
		||||
{
 | 
			
		||||
	GameInputMethod = EVRGameInputMethod::GameInput_Default;
 | 
			
		||||
	bAlsoChangeGamepPadInput = false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool UVRGameViewportClient::IsValidGamePadKey(const FKey & InputKey)
 | 
			
		||||
{
 | 
			
		||||
	if (!bAlsoChangeGamepPadInput)
 | 
			
		||||
		return false;
 | 
			
		||||
 | 
			
		||||
	FName KeyCategory = InputKey.GetMenuCategory();
 | 
			
		||||
	
 | 
			
		||||
	return GamepadInputCategories.Contains(KeyCategory);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool UVRGameViewportClient::EventWindowClosing()
 | 
			
		||||
{
 | 
			
		||||
	if (BPOnWindowCloseRequested.IsBound())
 | 
			
		||||
	{
 | 
			
		||||
		BPOnWindowCloseRequested.Broadcast();
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	if (bIgnoreWindowCloseCommands)
 | 
			
		||||
	{
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void UVRGameViewportClient::PostInitProperties()
 | 
			
		||||
{
 | 
			
		||||
	Super::PostInitProperties();
 | 
			
		||||
 | 
			
		||||
	if (GamepadInputCategories.Num() < 1)
 | 
			
		||||
	{
 | 
			
		||||
		GamepadInputCategories.Add(FName(TEXT("Gamepad")));
 | 
			
		||||
		GamepadInputCategories.Add(FName(TEXT("PS4")));
 | 
			
		||||
		GamepadInputCategories.Add(FName(TEXT("XBox One")));
 | 
			
		||||
		GamepadInputCategories.Add(FName(TEXT("Touch")));
 | 
			
		||||
		GamepadInputCategories.Add(FName(TEXT("Gesture")));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	OnWindowCloseRequested().BindUObject(this, &UVRGameViewportClient::EventWindowClosing);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
bool UVRGameViewportClient::InputKey(const FInputKeyEventArgs& EventArgs)
 | 
			
		||||
{
 | 
			
		||||
	// Remap the old int32 ControllerId value to the new InputDeviceId
 | 
			
		||||
	IPlatformInputDeviceMapper& DeviceMapper = IPlatformInputDeviceMapper::Get();
 | 
			
		||||
 | 
			
		||||
	// Early out if a gamepad event or ignoring input or is default setup / no GEngine
 | 
			
		||||
	if(GameInputMethod == EVRGameInputMethod::GameInput_Default || IgnoreInput() || (EventArgs.IsGamepad() && !IsValidGamePadKey(EventArgs.Key)))
 | 
			
		||||
		return Super::InputKey(EventArgs);
 | 
			
		||||
 | 
			
		||||
	const int32 NumLocalPlayers = World->GetGameInstance()->GetNumLocalPlayers();
 | 
			
		||||
 | 
			
		||||
	// Also early out if number of players is less than 2
 | 
			
		||||
	if (NumLocalPlayers < 2)
 | 
			
		||||
		return Super::InputKey(EventArgs);
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	// Its const so have to copy and send a new one in now that the function signature has changed
 | 
			
		||||
	FInputKeyEventArgs NewStruct = EventArgs;
 | 
			
		||||
 | 
			
		||||
	if (GameInputMethod == EVRGameInputMethod::GameInput_KeyboardAndMouseToPlayer2)
 | 
			
		||||
	{
 | 
			
		||||
		// keyboard / mouse always go to player 0, so + 1 will be player 2
 | 
			
		||||
		NewStruct.ControllerId++;
 | 
			
		||||
 | 
			
		||||
		FPlatformUserId UserId = PLATFORMUSERID_NONE;
 | 
			
		||||
		FInputDeviceId DeviceId = INPUTDEVICEID_NONE;
 | 
			
		||||
		DeviceMapper.RemapControllerIdToPlatformUserAndDevice(NewStruct.ControllerId, UserId, NewStruct.InputDevice);
 | 
			
		||||
 | 
			
		||||
		return Super::InputKey(NewStruct);
 | 
			
		||||
	}
 | 
			
		||||
	else // Shared keyboard and mouse
 | 
			
		||||
	{
 | 
			
		||||
		bool bRetVal = false;
 | 
			
		||||
		for (int32 i = 0; i < NumLocalPlayers; i++)
 | 
			
		||||
		{
 | 
			
		||||
			NewStruct.ControllerId = i;
 | 
			
		||||
 | 
			
		||||
			FPlatformUserId UserId = PLATFORMUSERID_NONE;
 | 
			
		||||
			FInputDeviceId DeviceId = INPUTDEVICEID_NONE;
 | 
			
		||||
			DeviceMapper.RemapControllerIdToPlatformUserAndDevice(NewStruct.ControllerId, UserId, NewStruct.InputDevice);
 | 
			
		||||
 | 
			
		||||
			bRetVal = Super::InputKey(NewStruct) || bRetVal;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return bRetVal;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool UVRGameViewportClient::InputAxis(FViewport* tViewport, FInputDeviceId InputDevice, FKey Key, float Delta, float DeltaTime, int32 NumSamples, bool bGamepad)
 | 
			
		||||
{		
 | 
			
		||||
	// Remap the old int32 ControllerId value to the new InputDeviceId
 | 
			
		||||
	IPlatformInputDeviceMapper& DeviceMapper = IPlatformInputDeviceMapper::Get();
 | 
			
		||||
 | 
			
		||||
	const int32 NumLocalPlayers = World->GetGameInstance()->GetNumLocalPlayers();
 | 
			
		||||
 | 
			
		||||
	// Early out if a gamepad or not a mouse event (vr controller) or ignoring input or is default setup / no GEngine
 | 
			
		||||
	if (((!Key.IsMouseButton() && !bGamepad) || (bGamepad && !IsValidGamePadKey(Key))) || NumLocalPlayers < 2 || GameInputMethod == EVRGameInputMethod::GameInput_Default || IgnoreInput())
 | 
			
		||||
		return Super::InputAxis(tViewport, InputDevice, Key, Delta, DeltaTime, NumSamples, bGamepad);
 | 
			
		||||
 | 
			
		||||
	if (GameInputMethod == EVRGameInputMethod::GameInput_KeyboardAndMouseToPlayer2)
 | 
			
		||||
	{
 | 
			
		||||
		// keyboard / mouse always go to player 0, so + 1 will be player 2
 | 
			
		||||
		int32 ControllerId = 1;
 | 
			
		||||
 | 
			
		||||
		FPlatformUserId UserId = PLATFORMUSERID_NONE;
 | 
			
		||||
		FInputDeviceId DeviceId = INPUTDEVICEID_NONE;
 | 
			
		||||
		DeviceMapper.RemapControllerIdToPlatformUserAndDevice(ControllerId, UserId, DeviceId);
 | 
			
		||||
 | 
			
		||||
		return Super::InputAxis(tViewport, DeviceId, Key, Delta, DeltaTime, NumSamples, bGamepad);
 | 
			
		||||
	}
 | 
			
		||||
	else // Shared keyboard and mouse
 | 
			
		||||
	{
 | 
			
		||||
		bool bRetVal = false;
 | 
			
		||||
		for (int32 i = 0; i < NumLocalPlayers; i++)
 | 
			
		||||
		{
 | 
			
		||||
			FPlatformUserId UserId = PLATFORMUSERID_NONE;
 | 
			
		||||
			FInputDeviceId DeviceId = INPUTDEVICEID_NONE;
 | 
			
		||||
			DeviceMapper.RemapControllerIdToPlatformUserAndDevice(i, UserId, DeviceId);
 | 
			
		||||
 | 
			
		||||
			bRetVal = Super::InputAxis(tViewport, DeviceId, Key, Delta, DeltaTime, NumSamples, bGamepad) || bRetVal;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return bRetVal;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -4,8 +4,8 @@
 | 
			
		|||
#include UE_INLINE_GENERATED_CPP_BY_NAME(VRLogComponent)
 | 
			
		||||
 | 
			
		||||
#include "Engine/Engine.h"
 | 
			
		||||
#include "GenericPlatform\GenericPlatformInputDeviceMapper.h"
 | 
			
		||||
#include "Engine\GameViewportClient.h"
 | 
			
		||||
#include "GenericPlatform/GenericPlatformInputDeviceMapper.h"
 | 
			
		||||
#include "Engine/GameViewportClient.h"
 | 
			
		||||
#include "GlobalRenderResources.h"
 | 
			
		||||
 | 
			
		||||
//#include "Engine/Engine.h"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,7 @@
 | 
			
		|||
#include "GlobalRenderResources.h"
 | 
			
		||||
#include "Components/ActorComponent.h"
 | 
			
		||||
#include "Kismet/GameplayStatics.h"
 | 
			
		||||
#include "GameFramework\Pawn.h"
 | 
			
		||||
#include "GameFramework/Pawn.h"
 | 
			
		||||
#include "GameFramework/PlayerState.h"
 | 
			
		||||
#include "GameFramework/PlayerController.h"
 | 
			
		||||
#include "Engine/TextureRenderTarget2D.h"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,9 +3,9 @@
 | 
			
		|||
#include UE_INLINE_GENERATED_CPP_BY_NAME(VRMoverComponent)
 | 
			
		||||
 | 
			
		||||
#include "VRBPDatatypes.h"
 | 
			
		||||
#include "DefaultMovementSet\LayeredMoves\BasicLayeredMoves.h"
 | 
			
		||||
#include "DefaultMovementSet/LayeredMoves/BasicLayeredMoves.h"
 | 
			
		||||
#include "Engine/BlueprintGeneratedClass.h"
 | 
			
		||||
#include "Curves\CurveFloat.h" // Delete after tests, only needed for cloning
 | 
			
		||||
#include "Curves/CurveFloat.h" // Delete after tests, only needed for cloning
 | 
			
		||||
#include "ReplicatedVRCameraComponent.h"
 | 
			
		||||
 | 
			
		||||
DEFINE_LOG_CATEGORY(LogVRMoverComponent);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@
 | 
			
		|||
 | 
			
		||||
#include "CoreMinimal.h"
 | 
			
		||||
#include "VRGlobalSettings.h"
 | 
			
		||||
#include "Components\PrimitiveComponent.h"
 | 
			
		||||
#include "Components/PrimitiveComponent.h"
 | 
			
		||||
#include "HAL/IConsoleManager.h"
 | 
			
		||||
#include "Chaos/ChaosEngineInterface.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,7 +19,7 @@
 | 
			
		|||
#include "Navigation/PathFollowingComponent.h"
 | 
			
		||||
#include "VRPlayerController.h"
 | 
			
		||||
#include "GameFramework/PhysicsVolume.h"
 | 
			
		||||
#include "Animation\AnimInstance.h"
 | 
			
		||||
#include "Animation/AnimInstance.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DEFINE_LOG_CATEGORY(LogVRBaseCharacterMovement);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -506,6 +506,8 @@ void UVRRootComponent::TickComponent(float DeltaTime, enum ELevelTick TickType,
 | 
			
		|||
 | 
			
		||||
	if (IsLocallyControlled())
 | 
			
		||||
	{
 | 
			
		||||
		bool bHadBadTracking = false;
 | 
			
		||||
 | 
			
		||||
		if (owningVRChar && owningVRChar->bTrackingPaused)
 | 
			
		||||
		{
 | 
			
		||||
			curCameraLoc = owningVRChar->PausedTrackingLoc;
 | 
			
		||||
| 
						 | 
				
			
			@ -524,6 +526,7 @@ void UVRRootComponent::TickComponent(float DeltaTime, enum ELevelTick TickType,
 | 
			
		|||
			{
 | 
			
		||||
				curCameraLoc = lastCameraLoc;
 | 
			
		||||
				curCameraRot = lastCameraRot;
 | 
			
		||||
				bHadBadTracking = true;
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
| 
						 | 
				
			
			@ -562,7 +565,7 @@ void UVRRootComponent::TickComponent(float DeltaTime, enum ELevelTick TickType,
 | 
			
		|||
		
 | 
			
		||||
 | 
			
		||||
		// Can adjust the relative tolerances to remove jitter and some update processing
 | 
			
		||||
		if (!bRetainRoomscale || (!curCameraLoc.Equals(lastCameraLoc, 0.01f) || !curCameraRot.Equals(lastCameraRot, 0.01f)))
 | 
			
		||||
		if (!bHadBadTracking && (!bRetainRoomscale || (!curCameraLoc.Equals(lastCameraLoc, 0.01f) || !curCameraRot.Equals(lastCameraRot, 0.01f))))
 | 
			
		||||
		{
 | 
			
		||||
			// Also calculate vector of movement for the movement component
 | 
			
		||||
			FVector LastPosition = OffsetComponentToWorld.GetLocation();
 | 
			
		||||
| 
						 | 
				
			
			@ -638,7 +641,6 @@ void UVRRootComponent::TickComponent(float DeltaTime, enum ELevelTick TickType,
 | 
			
		|||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
 | 
			
		||||
					// Run this first so we get full fidelity on the relative space calculation
 | 
			
		||||
					FVector NewLocation = StoredCameraRotOffset.RotateVector(FVector(VRCapsuleOffset.X, VRCapsuleOffset.Y, 0.0f)) + curCameraLoc;
 | 
			
		||||
					FVector PlanerLocation = NewLocation - lastCameraLoc;
 | 
			
		||||
| 
						 | 
				
			
			@ -1545,7 +1547,7 @@ bool UVRRootComponent::IsLocallyControlled() const
 | 
			
		|||
			GenerateOffsetToWorld();
 | 
			
		||||
		}*/
 | 
			
		||||
 | 
			
		||||
		if (!owningVRChar->bRetainRoomscale && !IsLocallyControlled())
 | 
			
		||||
		if (!owningVRChar->bRetainRoomscale && !IsLocallyControlled() && !IsNetMode(NM_DedicatedServer))
 | 
			
		||||
		{
 | 
			
		||||
			// Don't smooth this change in mesh position
 | 
			
		||||
			FNetworkPredictionData_Client_Character* ClientData = owningVRChar->GetCharacterMovement()->GetPredictionData_Client_Character();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -169,7 +169,7 @@ public:
 | 
			
		|||
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VRLeverComponent|Momentum Settings", meta = (ClampMin = "0.0", UIMin = "0.0"))
 | 
			
		||||
		float MaxLeverMomentum;
 | 
			
		||||
 | 
			
		||||
	UPROPERTY(BlueprintReadOnly, Category = "VRLeverComponent")
 | 
			
		||||
	UPROPERTY(BlueprintReadWrite, Category = "VRLeverComponent")
 | 
			
		||||
		bool bIsLerping;
 | 
			
		||||
 | 
			
		||||
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GripSettings")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -54,140 +54,12 @@ public:
 | 
			
		|||
	UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "VRExpansionPlugin")
 | 
			
		||||
		TArray<FName> GamepadInputCategories;
 | 
			
		||||
 | 
			
		||||
	bool IsValidGamePadKey(const FKey & InputKey)
 | 
			
		||||
	{
 | 
			
		||||
		if (!bAlsoChangeGamepPadInput)
 | 
			
		||||
			return false;
 | 
			
		||||
 | 
			
		||||
		FName KeyCategory = InputKey.GetMenuCategory();
 | 
			
		||||
		
 | 
			
		||||
		return GamepadInputCategories.Contains(KeyCategory);
 | 
			
		||||
	}
 | 
			
		||||
	bool IsValidGamePadKey(const FKey& InputKey);
 | 
			
		||||
 | 
			
		||||
	UFUNCTION()
 | 
			
		||||
	bool EventWindowClosing()
 | 
			
		||||
	{
 | 
			
		||||
		if (BPOnWindowCloseRequested.IsBound())
 | 
			
		||||
		{
 | 
			
		||||
			BPOnWindowCloseRequested.Broadcast();
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (bIgnoreWindowCloseCommands)
 | 
			
		||||
		{
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
		bool EventWindowClosing();
 | 
			
		||||
 | 
			
		||||
	virtual void PostInitProperties() override
 | 
			
		||||
	{
 | 
			
		||||
		Super::PostInitProperties();
 | 
			
		||||
 | 
			
		||||
		if (GamepadInputCategories.Num() < 1)
 | 
			
		||||
		{
 | 
			
		||||
			GamepadInputCategories.Add(FName(TEXT("Gamepad")));
 | 
			
		||||
			GamepadInputCategories.Add(FName(TEXT("PS4")));
 | 
			
		||||
			GamepadInputCategories.Add(FName(TEXT("XBox One")));
 | 
			
		||||
			GamepadInputCategories.Add(FName(TEXT("Touch")));
 | 
			
		||||
			GamepadInputCategories.Add(FName(TEXT("Gesture")));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		OnWindowCloseRequested().BindUObject(this, &UVRGameViewportClient::EventWindowClosing);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	virtual bool InputKey(const FInputKeyEventArgs& EventArgs) override
 | 
			
		||||
	{
 | 
			
		||||
		// Remap the old int32 ControllerId value to the new InputDeviceId
 | 
			
		||||
		IPlatformInputDeviceMapper& DeviceMapper = IPlatformInputDeviceMapper::Get();
 | 
			
		||||
 | 
			
		||||
		// Early out if a gamepad event or ignoring input or is default setup / no GEngine
 | 
			
		||||
		if(GameInputMethod == EVRGameInputMethod::GameInput_Default || IgnoreInput() || (EventArgs.IsGamepad() && !IsValidGamePadKey(EventArgs.Key)))
 | 
			
		||||
			return Super::InputKey(EventArgs);
 | 
			
		||||
 | 
			
		||||
		const int32 NumLocalPlayers = World->GetGameInstance()->GetNumLocalPlayers();
 | 
			
		||||
 | 
			
		||||
		// Also early out if number of players is less than 2
 | 
			
		||||
		if (NumLocalPlayers < 2)
 | 
			
		||||
			return Super::InputKey(EventArgs);
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
		// Its const so have to copy and send a new one in now that the function signature has changed
 | 
			
		||||
		FInputKeyEventArgs NewStruct = EventArgs;
 | 
			
		||||
 | 
			
		||||
		if (GameInputMethod == EVRGameInputMethod::GameInput_KeyboardAndMouseToPlayer2)
 | 
			
		||||
		{
 | 
			
		||||
			// keyboard / mouse always go to player 0, so + 1 will be player 2
 | 
			
		||||
			NewStruct.ControllerId++;
 | 
			
		||||
 | 
			
		||||
			FPlatformUserId UserId = PLATFORMUSERID_NONE;
 | 
			
		||||
			FInputDeviceId DeviceId = INPUTDEVICEID_NONE;
 | 
			
		||||
			DeviceMapper.RemapControllerIdToPlatformUserAndDevice(NewStruct.ControllerId, UserId, NewStruct.InputDevice);
 | 
			
		||||
 | 
			
		||||
			return Super::InputKey(NewStruct);
 | 
			
		||||
		}
 | 
			
		||||
		else // Shared keyboard and mouse
 | 
			
		||||
		{
 | 
			
		||||
			bool bRetVal = false;
 | 
			
		||||
			for (int32 i = 0; i < NumLocalPlayers; i++)
 | 
			
		||||
			{
 | 
			
		||||
				NewStruct.ControllerId = i;
 | 
			
		||||
 | 
			
		||||
				FPlatformUserId UserId = PLATFORMUSERID_NONE;
 | 
			
		||||
				FInputDeviceId DeviceId = INPUTDEVICEID_NONE;
 | 
			
		||||
				DeviceMapper.RemapControllerIdToPlatformUserAndDevice(NewStruct.ControllerId, UserId, NewStruct.InputDevice);
 | 
			
		||||
 | 
			
		||||
				bRetVal = Super::InputKey(NewStruct) || bRetVal;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			return bRetVal;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	virtual bool InputAxis(FViewport* tViewport, FInputDeviceId InputDevice, FKey Key, float Delta, float DeltaTime, int32 NumSamples = 1, bool bGamepad = false) override
 | 
			
		||||
	{		
 | 
			
		||||
		// Remap the old int32 ControllerId value to the new InputDeviceId
 | 
			
		||||
		IPlatformInputDeviceMapper& DeviceMapper = IPlatformInputDeviceMapper::Get();
 | 
			
		||||
 | 
			
		||||
		const int32 NumLocalPlayers = World->GetGameInstance()->GetNumLocalPlayers();
 | 
			
		||||
 | 
			
		||||
		// Early out if a gamepad or not a mouse event (vr controller) or ignoring input or is default setup / no GEngine
 | 
			
		||||
		if (((!Key.IsMouseButton() && !bGamepad) || (bGamepad && !IsValidGamePadKey(Key))) || NumLocalPlayers < 2 || GameInputMethod == EVRGameInputMethod::GameInput_Default || IgnoreInput())
 | 
			
		||||
			return Super::InputAxis(tViewport, InputDevice, Key, Delta, DeltaTime, NumSamples, bGamepad);
 | 
			
		||||
 | 
			
		||||
		if (GameInputMethod == EVRGameInputMethod::GameInput_KeyboardAndMouseToPlayer2)
 | 
			
		||||
		{
 | 
			
		||||
			// keyboard / mouse always go to player 0, so + 1 will be player 2
 | 
			
		||||
			int32 ControllerId = 1;
 | 
			
		||||
 | 
			
		||||
			FPlatformUserId UserId = PLATFORMUSERID_NONE;
 | 
			
		||||
			FInputDeviceId DeviceId = INPUTDEVICEID_NONE;
 | 
			
		||||
			DeviceMapper.RemapControllerIdToPlatformUserAndDevice(ControllerId, UserId, DeviceId);
 | 
			
		||||
 | 
			
		||||
			return Super::InputAxis(tViewport, DeviceId, Key, Delta, DeltaTime, NumSamples, bGamepad);
 | 
			
		||||
		}
 | 
			
		||||
		else // Shared keyboard and mouse
 | 
			
		||||
		{
 | 
			
		||||
			bool bRetVal = false;
 | 
			
		||||
			for (int32 i = 0; i < NumLocalPlayers; i++)
 | 
			
		||||
			{
 | 
			
		||||
				FPlatformUserId UserId = PLATFORMUSERID_NONE;
 | 
			
		||||
				FInputDeviceId DeviceId = INPUTDEVICEID_NONE;
 | 
			
		||||
				DeviceMapper.RemapControllerIdToPlatformUserAndDevice(i, UserId, DeviceId);
 | 
			
		||||
 | 
			
		||||
				bRetVal = Super::InputAxis(tViewport, DeviceId, Key, Delta, DeltaTime, NumSamples, bGamepad) || bRetVal;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			return bRetVal;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
UVRGameViewportClient::UVRGameViewportClient(const FObjectInitializer& ObjectInitializer)
 | 
			
		||||
	: Super(ObjectInitializer)
 | 
			
		||||
{
 | 
			
		||||
	GameInputMethod = EVRGameInputMethod::GameInput_Default;
 | 
			
		||||
	bAlsoChangeGamepPadInput = false;
 | 
			
		||||
}
 | 
			
		||||
	virtual void PostInitProperties() override;
 | 
			
		||||
	virtual bool InputKey(const FInputKeyEventArgs& EventArgs) override;
 | 
			
		||||
	virtual bool InputAxis(FViewport* tViewport, FInputDeviceId InputDevice, FKey Key, float Delta, float DeltaTime, int32 NumSamples = 1, bool bGamepad = false) override;
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -6,7 +6,7 @@
 | 
			
		|||
//#include "Engine/Engine.h"
 | 
			
		||||
#include "VRBPDatatypes.h"
 | 
			
		||||
#include "Engine/DataAsset.h"
 | 
			
		||||
#include "Components\SceneComponent.h"
 | 
			
		||||
#include "Components/SceneComponent.h"
 | 
			
		||||
 | 
			
		||||
//#include "Engine/EngineTypes.h"
 | 
			
		||||
//#include "Engine/EngineBaseTypes.h"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue