Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
Fix camera / head position appears way above ground for OpenVR (#734)
Browse files Browse the repository at this point in the history
  • Loading branch information
FejZa authored Dec 22, 2020
1 parent 2b59a93 commit 99821e9
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Runtime/Providers/CameraSystem/BaseCameraDataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public override void Initialize()

if (CameraRig == null)
{
// TODO Currently we get always get the main camera. Should we provide a tag to search for alts?
// TODO Currently we always get the main camera. Should we provide a tag to search for alts?
CameraRig = CameraCache.Main.gameObject.EnsureComponent(cameraRigType) as IMixedRealityCameraRig;
Debug.Assert(CameraRig != null);
}
Expand Down Expand Up @@ -243,10 +243,22 @@ public override void Destroy()
/// </summary>
protected virtual void ApplySettingsForDefaultHeadHeight()
{
if (!HeadHeightIsManagedByDevice)
// We need to check whether the application is playing or not here.
// Since this code is executed even when not in play mode, we want
// to definitely apply the head height configured in the editor, when
// not in play mode. It helps with working in the editor and visualizing
// the user's perspective. When running though, we need to make sure we do
// not interfere with any platform provided head pose tracking.
if (!Application.isPlaying || !HeadHeightIsManagedByDevice)
{
HeadHeight = DefaultHeadHeight;
}
// If we are running and the device/platform provides the head pose,
// we need to make sure to reset any applied head height while in edit mode.
else if (Application.isPlaying && HeadHeightIsManagedByDevice)
{
HeadHeight = 0f;
}

ResetRigTransforms();
SyncRigTransforms();
Expand Down

0 comments on commit 99821e9

Please sign in to comment.