x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

VIVE HMD Lag When 'Lock To HMD' is Set to Off in 4.20.

I upgraded to 4.20 and after a while of happily using it realized that the visuals in the HMD were lagging in a way that they never did in version 4.19. The lag goes away if I set the 'lock to HMD' variable to 'on', however I don't want to do this because the game I'm building requires the HMD view to be set relative to the controller position (I'm building an actuated flight simulator and so can't have the view of the HMD change as the actuators move, I get around this problem by having the view be set relative to a controller that is on the seat and so also moves with the actuators). I can't go back to version 4.19 and every time I try some of my files stop working. Does anybody know where this lag is coming from?

Any help with this problem would be very much appreciated. Thanks!

Product Version: UE 4.20
Tags:
more ▼

asked Aug 14 '18 at 09:42 AM in VR

avatar image

Consilience
3 2

avatar image Hustlan Aug 24 '18 at 09:40 AM

I have the same problem

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

I had the same problem, btw it's not exclusive to VIVE, starting from 4.20 unticking bLockToHmd disables LateUpdate which introduces a noticeable lag. The best workaround over this is to create a new class that inherits 'UCameraComponent' and override 'GetCameraView' function with this code:

 void UCameraComponent::GetCameraView(float DeltaTime, FMinimalViewInfo& DesiredView)
 {
     if (GEngine && GEngine->XRSystem.IsValid() && GetWorld() && GetWorld()->WorldType != EWorldType::Editor )
     {
         IXRTrackingSystem* XRSystem = GEngine->XRSystem.Get();
         auto XRCamera = XRSystem->GetXRCamera();
 
         if (XRCamera.IsValid())
         {
             if (XRSystem->IsHeadTrackingAllowed())
             {
                 const FTransform ParentWorld = CalcNewComponentToWorld(FTransform());
 
                 if (bLockToHmd)
                 {
                     XRCamera->SetupLateUpdate(ParentWorld, this, false);
 
                     FQuat Orientation;
                     FVector Position;
                     if (XRCamera->UpdatePlayerCamera(Orientation, Position))
                     {
                         SetRelativeTransform(FTransform(Orientation, Position));
                     }
                     else
                     {
                         ResetRelativeTransform();
                     }
                 }
 
                 XRCamera->OverrideFOV(this->FieldOfView);
             }
         }
     }
 
     if (bUsePawnControlRotation)
     {
         const APawn* OwningPawn = Cast<APawn>(GetOwner());
         const AController* OwningController = OwningPawn ? OwningPawn->GetController() : nullptr;
         if (OwningController && OwningController->IsLocalPlayerController())
         {
             const FRotator PawnViewRotation = OwningPawn->GetViewRotation();
             if (!PawnViewRotation.Equals(GetComponentRotation()))
             {
                 SetWorldRotation(PawnViewRotation);
             }
         }
     }
 
     if (bUseAdditiveOffset)
     {
         FTransform OffsetCamToBaseCam = AdditiveOffset;
         FTransform BaseCamToWorld = GetComponentToWorld();
         FTransform OffsetCamToWorld = OffsetCamToBaseCam * BaseCamToWorld;
 
         DesiredView.Location = OffsetCamToWorld.GetLocation();
         DesiredView.Rotation = OffsetCamToWorld.Rotator();
     }
     else
     {
         DesiredView.Location = GetComponentLocation();
         DesiredView.Rotation = GetComponentRotation();
     }
 
     DesiredView.FOV = bUseAdditiveOffset ? (FieldOfView + AdditiveFOVOffset) : FieldOfView;
     DesiredView.AspectRatio = AspectRatio;
     DesiredView.bConstrainAspectRatio = bConstrainAspectRatio;
     DesiredView.bUseFieldOfViewForLOD = bUseFieldOfViewForLOD;
     DesiredView.ProjectionMode = ProjectionMode;
     DesiredView.OrthoWidth = OrthoWidth;
     DesiredView.OrthoNearClipPlane = OrthoNearClipPlane;
     DesiredView.OrthoFarClipPlane = OrthoFarClipPlane;
 
     // See if the CameraActor wants to override the PostProcess settings used.
     DesiredView.PostProcessBlendWeight = PostProcessBlendWeight;
     if (PostProcessBlendWeight > 0.0f)
     {
         DesiredView.PostProcessSettings = PostProcessSettings;
     }
 }

more ▼

answered Aug 30 '18 at 08:19 AM

avatar image

ortroll
137 1 5 9

avatar image ortroll Sep 03 '18 at 10:56 AM

And don't forget to mark this as answered :)

avatar image MasterOfShapes Oct 11 '18 at 04:29 AM

Having the same issue but does the answer givin require the engine to be built from source?

avatar image ortroll Oct 15 '18 at 03:07 PM

No, you can simply create a child of UCameraComponent inside your project.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question