Include the following details (edit as applicable):
Platform category: Unity 6000.3.11f1
Device Model & OS version: Ex: Windows10 (Playback)
NSDK or Scaniverse version: NSDK4.0
Hi,
I am exploring the VPS2 feature in NSDK4 now. I could successfully use TryTrackAnchor() by getting the payload from SiteClientManager, and use TryGetLatestTransformer() to ensure it is in the Precise tracking state. And I am testing VPS2 using the Playback in the editor.
I could also attach my own GameObjet as the child of the anchor of the Site. However, I could not use TryCreateAnchor to get a new anchor for placing virtual content at another location. The official documentation about this feature is too simple, so I don’t know how to fix it.
I’ll look into this on my end and get back to you as soon as I can or if I have any additional questions.
I did want to ask, I noticed in the details you provided for Device Model & OS Version it says “Ex: Windows 10…” was that a typo or are you developing on Windows 10? Windows development is not fully supported and still experimental. Do you happen to have a Mac that you can test this on to see if it’s only happening to you on Windows and not Mac?
Thanks for the quick response! Good to know the windows development is experimental.
TryCreateAnchor() also does not work on Mac either. I tried to place a cube into the VPS location, using the following code snippet. The TryCreateAnchor() returns false.
private void PlaceCube()
{
Vector3 position = Camera.main.transform.position + Camera.main.transform.forward * 5.0f;
position.y = 0.0f;
Quaternion rotation = Quaternion.identity;
Pose pose = new Pose(position, rotation);
if (arVps2Manager.TryCreateAnchor(pose, out var anchor))
{
var cube = Instantiate(cubePrefab, anchor.transform);
cube.transform.SetParent(anchor.transform);
Debug.Log("Cube placed and attached to VPS Anchor");
}
else
{
Debug.LogError("Failed to create VPS Anchor");
}
}
TryTrackAnchor and TryGetLatestTransformer work well on Mac. And I could see the cube attached to the anchor using the VPS location’s payload.
I would like to provide you with more information about my exploration on TryCreateAnchor().
TryCreateAnchor() always returned false, even though I tried to test with other different Pose as the argument.
I find there is a method called TryGetPose() in ARVps2Manager and I could successfully get the XRVps2Pose. Then I use the Pose from XRVps2Pose as the argument for TryCreateAnchor(). But it still does not work.
Hence, I wonder what kind of Pose is valid in VPS2 to let TryCreateAnchor() return true and give me back a valid anchor. I could not find any documentation in detail to guide me except this webpage: Placing Virtual Content with VPS2 | Niantic Spatial Platform
Thanks for the additional info. I’m still looking into it on my end but this, I was also having some strange issues with the TryCreateAnchor function so I’m seeing if this is a bug of sorts. I’ll keep you posted
It does look like the documentation we have for TryCreateAnchor is misleading and will be addressed. TryCreateAnchor is primarily beneficial when you’re attempting to render a 3D object that is much farther from the original location’s anchor; say by like about 100 meters. So, you shouldn’t be using that function for your purposes.
Here is the preferred workflow that one of our engineers shared with me. You might have already done most of these steps; I think step 4 would be the more relevant one.
Create Sites using Scaniverse
Select target Site(s), either copy anchor payload data from Scaniverse web site and paste into code, or use Sites API and build UI to let the user select target.
Use TryTrackAnchor() passing the anchor payload from above step, make sure to keep the anchor created from the API
Content placement should be done by setting the 3D content transform relative to the anchor transform after the anchor enters the tracking state. In Unity, this will be more straightforward as the anchor appears in the scene graph automatically and you can put 3D content under the anchor gameobject relative to it.
I will mark that as the solution and close this issue.
Btw, the docs seems quite misleading given your explanation now . Maybe it is nice to add more descriptions and use recommendations. The old ARDK3 docs about VPS was quite easier to learn.