text
stringlengths 0
1.11k
|
|---|
public IEnumerator anchorErased(OVRSpatialAnchor osAnchor)
|
{
|
while (!osAnchor.Created)
|
{
|
yield return new WaitForEndOfFrame();
|
}
|
//when ready, erase the anchor.
|
osAnchor.Erase((anchor, success) =>
|
{
|
if (!success)
|
{
|
Debug.Log("Anchor " + osAnchor.Uuid.ToString() + " NOT Erased!");
|
} else
|
{
|
Debug.Log("Anchor " + osAnchor.Uuid.ToString() + " Erased!");
|
;
|
}
|
return;
|
});
|
}
|
/********************************* Display an Anchor Prefab *****************/
|
/*
|
* Display an anchor prefab, red or green
|
*/
|
private GameObject PlaceAnchor(GameObject prefab, Vector3 p, Quaternion r)
|
{
|
//Debug.Log("Placing a new anchor prefab!");
|
return Instantiate(prefab, p, r);
|
}
|
/******************These three methods simulate an external store, such as PlayerPrefs ******************/
|
/*
|
* Add one spatial anchor to the external store
|
*/
|
private void SaveAnchorUuidToExternalStore(OVRSpatialAnchor spAnchor)
|
{
|
if(_anchorSavedUUIDListSize < _anchorSavedUUIDListMaxSize)
|
{
|
_anchorSavedUUIDList[_anchorSavedUUIDListSize] = (spAnchor.Uuid);
|
_anchorSavedUUIDListSize++;
|
//Debug.Log("Saved Anchor " + spAnchor.Uuid.ToString() + " to a external Store!");
|
}
|
else
|
{
|
//Debug.Log("Can't save anchor " + spAnchor.Uuid.ToString() + ", because the store is full!");
|
}
|
return;
|
}
|
/*
|
* Get all spatial anchor UUIDs saved to the external store
|
*/
|
private System.Guid[] GetAnchorsUuidsFromExternalStore()
|
{
|
var uuids = new Guid[_anchorSavedUUIDListSize];
|
for (int i = 0; i < _anchorSavedUUIDListSize; ++i)
|
{
|
var uuidKey = "uuid" + i;
|
var currentUuid = _anchorSavedUUIDList[i].ToByteArray();
|
uuids[i] = new Guid(currentUuid);
|
}
|
//Debug.Log("Returned All Anchor UUIDs!");
|
return uuids;
|
}
|
/*
|
* Empty the external external store
|
*/
|
private void RemoveAllAnchorsUuidsInExternalStore()
|
{
|
_anchorSavedUUIDList = new System.Guid[_anchorSavedUUIDListMaxSize];
|
//Debug.Log("Cleared the external Store!");
|
return;
|
}
|
}
|
ChatGPT
|
The "Unity Custom Scene Manager Sample" document you're referencing appears to be part of Unity's extensive VR development tutorials focused on using Oculus VR (specifically the Quest series) technology. It provides an in-depth guide on building custom scene managers to handle VR scene data more efficiently, leveraging Oculus' VR-specific components like OVRCameraRig and OVRManager, and the spatial anchoring system through OVRAnchor.
|
Here’s a breakdown of the main sections and key concepts covered:
|
Prerequisites: Ensures developers are familiar with the foundational concepts and tools necessary for VR development in Unity, including the OVRAnchor API for spatial data manipulation.
|
Setting Permissions for Spatial Data: The document outlines steps to set permissions within the Unity environment for accessing and manipulating spatial data, essential for VR applications that interact deeply with the user's physical environment.
|
Scene Manager Overview:
|
Basic Scene Manager: Introduces a simple scene manager that loads scene data and uses it to spawn Unity primitives at runtime based on the spatial layout.
|
Prefab Scene Manager: Extends the basic version by spawning prefabricated objects (prefabs) instead of primitives, allowing for a richer environment.
|
Snapshot Scene Manager: Manages dynamic changes in the scene by regularly updating and comparing snapshots of the scene data to track and log changes.
|
Dynamic Scene Manager: Further builds on the Snapshot manager by actively updating the Unity scene in response to changes detected in the scene data snapshots.
|
Key Assets: Lists the scripts and assets needed for the scene manager functionality, all stored under specific directories within the Unity project.
|
Each scene manager type demonstrates different strategies for handling VR scene data, from static loading and instantiation to dynamic updates based on real-time changes in the environment. This flexibility is crucial for creating responsive and immersive VR experiences.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.