Skip to content

Commit

Permalink
Merge pull request #20 from Priyanshu-CODERX/Persistance-Rig
Browse files Browse the repository at this point in the history
Rig Persistance for Scene Switching
  • Loading branch information
Priyanshu-CODERX authored Oct 28, 2023
2 parents 7a0cb42 + 2981df1 commit 86ee930
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 29 deletions.
15 changes: 15 additions & 0 deletions Assets/OVRTK/Prefabs/Components/OVRTK Camera Rig.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 1397934825224362951}
- component: {fileID: 5666297426116378531}
- component: {fileID: 3649031560700094365}
- component: {fileID: 3223435628727167195}
- component: {fileID: 761392224187919499}
m_Layer: 0
m_Name: OVRTK Camera Rig
Expand Down Expand Up @@ -87,6 +88,20 @@ MonoBehaviour:
horizontalSpeed: 2
verticalSpeed: 2
EnableSimulator: 0
--- !u!114 &3223435628727167195
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 761392224187919501}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 02ed6da50297342aaa1de23e4d398695, type: 3}
m_Name:
m_EditorClassIdentifier:
OVRTK_Rig: {fileID: 761392224187919501}
EnablePersistance: 0
--- !u!81 &761392224187919499
AudioListener:
m_ObjectHideFlags: 0
Expand Down
4 changes: 4 additions & 0 deletions Assets/OVRTK/Scenes/360 Video/360Demo.unity
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ PrefabInstance:
propertyPath: m_Name
value: OVRTK Camera Rig
objectReference: {fileID: 0}
- target: {fileID: 761392224187919501, guid: 054b12e31717fcc47a375fcc438085d7, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5666297426116378531, guid: 054b12e31717fcc47a375fcc438085d7, type: 3}
propertyPath: logUtils
value:
Expand Down
8 changes: 8 additions & 0 deletions Assets/OVRTK/Scenes/OVRTK_SampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,18 @@ PrefabInstance:
propertyPath: m_Name
value: OVRTK Camera Rig
objectReference: {fileID: 0}
- target: {fileID: 3223435628727167195, guid: 054b12e31717fcc47a375fcc438085d7, type: 3}
propertyPath: EnablePersistance
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3649031560700094365, guid: 054b12e31717fcc47a375fcc438085d7, type: 3}
propertyPath: EnableSimulator
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5562324977107085019, guid: 054b12e31717fcc47a375fcc438085d7, type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 054b12e31717fcc47a375fcc438085d7, type: 3}
--- !u!1 &804576818
Expand Down
11 changes: 5 additions & 6 deletions Assets/OVRTK/Scripts/Core/GyroscopeManager.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using UnityEngine;

/// <summary>
/// This script is responsible for managing the gyroscope functionality of a device and updating the rotation of a GameObject accordingly.
/// </summary>
public class GyroscopeManager : MonoBehaviour
{
/// <summary>
/// This script is responsible for managing the gyroscope functionality of a device and updating the rotation of a GameObject accordingly.
/// </summary>

private GyroscopeStateManager gyroscopeStateManager;
public GyroscopeStateManager GyroscopeStateManager
{
Expand Down
17 changes: 8 additions & 9 deletions Assets/OVRTK/Scripts/Core/GyroscopeStateManager.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using UnityEngine;

/// <summary>
/// The code is for managing gyroscope support in Unity.
/// It checks whether the device supports a gyroscope, and if it doesn't, it enables a warning popup.
/// The script also has a reference to a SimulationManager component and a GyroscopeManager array, as well as a Quaternion variable for storing rotation data.
/// The SimulationManager component is set in the Start() method, and the enableGyroNotSupportedWarning() method is called to show the popup if necessary.
/// </summary>
public class GyroscopeStateManager : MonoBehaviour
{
/// <summary>
/// The code is for managing gyroscope support in Unity.
/// It checks whether the device supports a gyroscope, and if it doesn't, it enables a warning popup.
/// The script also has a reference to a SimulationManager component and a GyroscopeManager array, as well as a Quaternion variable for storing rotation data.
/// The SimulationManager component is set in the Start() method, and the enableGyroNotSupportedWarning() method is called to show the popup if necessary.
/// </summary>

private bool isGyroSupported;
public GyroscopeManager[] gyroscopeManager;
public GameObject _GyroNotSupportedPopUp;
Expand Down
22 changes: 22 additions & 0 deletions Assets/OVRTK/Scripts/Core/RigPersistance.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

///<summary>
/// The Persistence Rig is designed to enable smooth transitions between scenes without the need to reinitialize the OVRTK from scratch.
///</summary>
public class RigPersistance : MonoBehaviour
{
[SerializeField]
private GameObject OVRTK_Rig;

public bool EnablePersistance = false;

private void Start()
{
if (EnablePersistance)
{
DontDestroyOnLoad(OVRTK_Rig);
}
}
}
11 changes: 11 additions & 0 deletions Assets/OVRTK/Scripts/Core/RigPersistance.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Assets/OVRTK/Scripts/Core/SimulationManager.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using UnityEngine;

/// <summary>
/// The above code defines a simulation manager that simulates a 3D experience using the mouse as input.
/// It has three public properties for adjusting the horizontal and vertical speed of the mouse movement and a boolean flag for enabling the simulator.
/// </summary>
public class SimulationManager : MonoBehaviour
{
/// <summary>
/// The above code defines a simulation manager that simulates a 3D experience using the mouse as input.
/// It has three public properties for adjusting the horizontal and vertical speed of the mouse movement and a boolean flag for enabling the simulator.
/// </summary>
public float horizontalSpeed = 2f;
public float verticalSpeed = 2f;
public bool EnableSimulator;
Expand Down
15 changes: 7 additions & 8 deletions Assets/OVRTK/Scripts/Core/StereoscopeManager.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using UnityEngine;

/// <summary>
/// This script is used to create a stereoscopic effect for a virtual reality experience.
/// It sets up two cameras in the scene, one for the left eye and one for the right eye, and positions them to match the distance between the user's eyes, known as the interpupillary distance.
/// It also includes variables for eye height and eye depth, which can be adjusted to match the user's physical characteristics.
/// </summary>
public class StereoscopeManager : MonoBehaviour
{
/// <summary>
/// This script is used to create a stereoscopic effect for a virtual reality experience.
/// It sets up two cameras in the scene, one for the left eye and one for the right eye, and positions them to match the distance between the user's eyes, known as the interpupillary distance.
/// It also includes variables for eye height and eye depth, which can be adjusted to match the user's physical characteristics.
/// </summary>

[SerializeField]
private Camera leftCamera;

Expand Down
3 changes: 3 additions & 0 deletions ProjectSettings/EditorBuildSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ EditorBuildSettings:
- enabled: 1
path: Assets/OVRTK/Scenes/360 Video/360Demo.unity
guid: b0b83dbbd4866204aaa38e66dcfeac87
- enabled: 1
path: Assets/OVRTK/Scenes/OVRTK_SampleScene.unity
guid: 4c9b652dc705a374086c1bad6b8545ea
m_configObjects:
UnityEditor.XR.ARCore.ARCoreSettings: {fileID: 11400000, guid: 2e0e21c36b1f344448b879b9110e9989, type: 2}
com.unity.xr.management.loader_settings: {fileID: 11400000, guid: 41bca3df2477f0a43b0a371d5991aa79, type: 2}

0 comments on commit 86ee930

Please sign in to comment.