Skip to content
Snippets Groups Projects
Commit 812ed426 authored by David Gilbert's avatar David Gilbert :bug:
Browse files

Merge branch 'dev/5.4' into 'dev/5.5'

Pull dev/5.4 changes into dev/5.5

See merge request !113
parents 84c7c8a9 8df591ea
No related branches found
No related tags found
1 merge request!113Pull dev/5.4 changes into dev/5.5
Pipeline #604710 passed
......@@ -26,8 +26,8 @@ void UClientTransformReplication::UpdateState(float DeltaTime)
// Only do this if we actually replicate the actor
if (GetIsReplicated())
{
const FVector Loc = OwningActor->GetActorLocation();
const FRotator Rot = OwningActor->GetActorRotation();
const FVector Loc = OwningActor->GetRootComponent()->GetRelativeLocation();
const FRotator Rot = OwningActor->GetRootComponent()->GetRelativeRotation();
// Only update state if the local state changed
if (!Loc.Equals(ReplicatedTransform.Position) || !Rot.Equals(ReplicatedTransform.Rotation))
......
......@@ -70,6 +70,13 @@ void UDirectInteractionComponent::TickComponent(float DeltaTime, ELevelTick Tick
// Call hover end events on all components that were previously in range, but not anymore
for (UInteractableComponent* PrevInteractableComp : PreviousInteractableComponentsInRange)
{
// It can happen that a previous component was destroyed
if (!PrevInteractableComp || !PrevInteractableComp->IsValidLowLevel())
{
ComponentsToRemove.Add(PrevInteractableComp); // might have to use indices here
continue;
}
if (!CurrentInteractableCompsInRange.Contains(PrevInteractableComp))
{
ComponentsToRemove.AddUnique(PrevInteractableComp);
......
......@@ -156,14 +156,18 @@ void ARWTHVRPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponen
if (ARWTHVRPlayerState* State = GetPlayerState<ARWTHVRPlayerState>())
{
// Might not be properly synced yet?
const EPlayerType Type = State->GetPlayerType();
EPlayerType Type = State->GetPlayerType();
// Don't do anything with the type if it's been set to clustertype or anything.
// This is already being done when connecting to the server.
const bool bClusterType = Type == EPlayerType::nDisplayPrimary || Type == EPlayerType::nDisplaySecondary;
if (!bClusterType && URWTHVRUtilities::IsHeadMountedMode())
if (!bClusterType)
{
if (URWTHVRUtilities::IsHeadMountedMode())
Type = EPlayerType::HMD;
UE_LOGFMT(Toolkit, Display, "Pawn: Requesting Player Type {T}...", StaticCast<int8>(Type));
// Could be too early to call this RPC...
State->RequestSetPlayerType(Type);
}
......
#include "Utility/RWTHVRUtilities.h"
#include "AudioDevice.h"
#include "HeadMountedDisplayFunctionLibrary.h"
#include "IHeadMountedDisplay.h"
#include "IXRTrackingSystem.h"
#include "Engine/Engine.h"
......@@ -16,12 +17,7 @@ DEFINE_LOG_CATEGORY(Toolkit);
bool URWTHVRUtilities::IsDesktopMode() { return !IsRoomMountedMode() && !IsHeadMountedMode(); }
bool URWTHVRUtilities::IsHeadMountedMode()
{
// In editor builds: checks for EdEngine->IsVRPreviewActive()
// In packaged builds: checks for `-vr` in commandline or bStartInVR in UGeneralProjectSettings
return FAudioDevice::CanUseVRAudioDevice();
}
bool URWTHVRUtilities::IsHeadMountedMode() { return UHeadMountedDisplayFunctionLibrary::IsHeadMountedDisplayEnabled(); }
bool URWTHVRUtilities::IsRoomMountedMode()
{
......
......@@ -56,7 +56,10 @@ protected:
// For now, directly apply the transforms:
auto* OwningActor = GetOwner();
if (OwningActor && OwningActor->HasValidRootComponent())
OwningActor->SetActorLocationAndRotation(ReplicatedTransform.Position, ReplicatedTransform.Rotation);
{
OwningActor->SetActorRelativeLocation(ReplicatedTransform.Position);
OwningActor->SetActorRelativeRotation(ReplicatedTransform.Rotation);
}
}
// Unreliable Server RPC that sends the transform from owning client to the server
......
......@@ -38,7 +38,7 @@ public class RWTHVRToolkit : ModuleRules
PrivateDependencyModuleNames.AddRange(
new string[]
{
"NetCore"
"NetCore", "XRBase"
}
);
if (Target.bBuildEditor == true)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment