Forum Discussion
Gogrilla
3 years agoHonored Guest
Where to get OVRSpatialAnchor when loading unbound anchors?
I'm able to create and re-load spatial anchors, but when I reload the unbound anchors I'm unclear on where to get the OVRSpatialAnchor from.
The docs say to bind to an OVRSpatialAnchor after Localized. In the sample it looks like this:
var spatialAnchor = Instantiate(_anchorPrefab, unboundAnchor.Pose.position, unboundAnchor.Pose.rotation);
I'm unclear on where the _anchorPrefab is coming from though as that is also an OVRSpatialAnchor. Is there a way to do this that doesn't use a prefab? When I create my original game object and anchor I'm doing it this way:
var gameObject =
GameObject.Instantiate(Resources.Load<GameObject(gameObjectPath),
worldObjectPose.position,
worldObjectPose.orientation);
var ovrSpatialAnchor = gameObject.AddComponent<OVRSpatialAnchor>();
As a follow up, I found an answer. The game object must be Instatiate'd with a prefab, and that prefab must have an attached OVRSpatialAnchor.
There is an example of a prefab like this at /Assets/Oculus/SampleFramework/usage/SpatialAnchor/Prefabs/DemoAnchorPrefab.prefab
1 Reply
- GogrillaHonored Guest
As a follow up, I found an answer. The game object must be Instatiate'd with a prefab, and that prefab must have an attached OVRSpatialAnchor.
There is an example of a prefab like this at /Assets/Oculus/SampleFramework/usage/SpatialAnchor/Prefabs/DemoAnchorPrefab.prefab
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 10 months ago
- 2 years ago
- 1 year ago