Log in or register to post comments

How to "Reset" Ground Plane...

March 20, 2018 - 9:37am #1

After using "DeployStageOnce" to instantiate an anchor with an associated gameobject, what is the best approach to accomplish the following tasks:

1) Reset the anchor position 

  • Would need to re-display the plane finder helper image...
  • Would need to re-enable the hit test for choosing a new location 

 

2) Flush the existing anchor position and ground plane content

  • Would destroy the child objects tied to the Ground Plane gameobject
  • Would enable instantiating a new child object that's tied to the Ground Plane gameobject
  • Would essentially "reset" the plane finding behaviour as if it had never been used previously

 

3) Plane finder status/quality feedback

  • Need to provide feedback to the user about how effective moving their device is in actually identifying the plane surface
  • Without some form of feedback, users may give up if lighting or conditions are poor

 

Surely these aren't unique requests...

 

Thanks!

 

 

How to "Reset" Ground Plane...

July 12, 2018 - 5:30am #3

 

Did you find solutions for your questions? Loking for exactly the same and i'm not that succesfull googlin'....

Cheers

How to "Reset" Ground Plane...

March 31, 2018 - 3:14pm #2

This could be expanded for your purposes.  Sorry about the formatting.

/*

* used to deploy the stage for vuforia

*/

using System;

using UnityEngine;

using Vuforia;

public class DeployStageOnce : MonoBehaviour {

public bool set;  // true if it ground plane is needing set

public GameObject AnchorStage;

private PositionalDeviceTracker _deviceTracker;

private GameObject _previousAnchor;

public void Start ()

{

  if (AnchorStage == null)

  {

   Debug.Log("AnchorStage must be specified");

   return;

  }

  AnchorStage.SetActive(false);

  set = true;  // start with setting the stage.  Set this again and script will reposition stage

}

public void Awake()

{

  VuforiaARController.Instance.RegisterVuforiaStartedCallback(OnVuforiaStarted);

}

public void OnDestroy()

{

  VuforiaARController.Instance.UnregisterVuforiaStartedCallback(OnVuforiaStarted);

}

private void OnVuforiaStarted()

{

  _deviceTracker = TrackerManager.Instance.GetTracker<PositionalDeviceTracker>();

}

public void OnInteractiveHitTest(HitTestResult result)

{

  if (!set)

   return;

 

  if (result == null || AnchorStage == null)

  {

   Debug.LogWarning("Hit test is invalid or AnchorStage not set");

   return;

  }

  var anchor = _deviceTracker.CreatePlaneAnchor(Guid.NewGuid().ToString(), result);

  if (anchor != null)

  {

   AnchorStage.transform.parent = anchor.transform;

   AnchorStage.transform.localPosition = Vector3.zero;

   AnchorStage.transform.localRotation = Quaternion.identity;

   AnchorStage.SetActive(true);

   if (_previousAnchor != null)

   {

    Destroy(_previousAnchor);

   }

   set = false; // turn off

  }

 

  _previousAnchor = anchor;

}

}

Log in or register to post comments