Log in or register to post comments

Deploy Stage Once Script now broken

March 20, 2018 - 7:58am #1

I loaded up Unity today and it prompted me to upgrade to Vuforia 7.1.27. Now, the DeployStageOnce script found at https://library.vuforia.com/articles/Solution/ground-plane-guide.html no longer works. I'm getting two compile errors:

DeployStageOnce.cs(49,51): error CS1061: Type `Vuforia.Anchor' does not contain a definition for `transform' and no extension method `transform' of type `Vuforia.Anchor' could be found. Are you missing an assembly reference?

DeployStageOnce.cs(60,27): error CS0029: Cannot implicitly convert type `Vuforia.Anchor' to `UnityEngine.GameObject'

I have updated Vuforia Ground Plane from the asset store to 7.1.30 and Vuforia Core Samples from the asset store to 7.1.30. I have also restarted Unity. I'm currently running Unity 2018.1.0b11.

Any idea what's going on?

Deploy Stage Once Script now broken

February 25, 2019 - 10:58am #14

Hello,

I'm not familiar with the script DeployStageOnce.cs.

Is it packaged with any of the Vuforia sample applications?

Thanks,

Vuforia Engine Support

Deploy Stage Once Script now broken

February 22, 2019 - 6:03pm #13

Some please help im doing a project in unity that deals with ground plane and voice control ai WIT.ai but my script is broken something do to with the anchor is not responding pro

 

 

 

 

 

Error #1) Assets\Scripts\DeployStageOnce.cs(50,42): error CS1061: 'Anchor' does not contain a definition for 'transform' and no accessible extension method 'transform' accepting a first argument of type 'Anchor' could be found (are you missing a using directive or an assembly reference?)



Error #2) Assets\Scripts\DeployStageOnce.cs(56,27): error CS1061: 'Anchor' does not contain a definition for 'name' and no accessible extension method 'name' accepting a first argument of type 'Anchor' could be found (are you missing a using directive or an assembly reference?)

Error #3) Assets\Scripts\DeployStageOnce.cs(63,21): error CS0029: Cannot implicitly convert type 'Vuforia.Anchor' to 'UnityEngine.GameObject'

This is the deploy stage once script, without this script being fixed i cannot continue, none of my other scripts run and im using the latest Unity 2018.3.6f1



using System;

using UnityEngine;

using Vuforia;

public class DeployStageOnce : MonoBehaviour {

public GameObject AnchorStage;

private PositionalDeviceTracker _deviceTracker;

private GameObject _previousAnchor;

public static string theRoute;

public void Start ()

{

if (AnchorStage == null)

{

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

return;

}

AnchorStage.SetActive(false);

}

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 (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);

}

theRoute = "/" + anchor.name + "/" + AnchorStage.name;

if (_previousAnchor != null)

{

Destroy(_previousAnchor);

}

_previousAnchor = anchor;

}

}

Deploy Stage Once Script now broken

October 30, 2018 - 6:06pm #12

HI gsylvain thanks for share your solution, but please give us more details about it. What's model, visual and m_PlaneFinder? How you get that?

 

Deploy Stage Once Script now broken

July 19, 2018 - 7:58am #11

I've found the solution yesterday.



I added the component "AnchorBehaviour" on my augmented visual. You have to configure this component with the Anchor.

Pseudo code:



Vector3 screenPos = Camera.main.WorldToScreenPoint(model.transform.position);

m_PlaneFinder.PerformHitTest(screenPos);

 

Then in the callback function receiving the HitTestResult:

Anchor anchor = TrackerManager.Instance.GetTracker<PositionalDeviceTracker>().CreatePlaneAnchor("robot_anchor", hitResult);

visual.GetComponent<AnchorBehaviour>().ConfigureAnchor(anchor);

visual.transform.position = model.transform.position;

visual.transform.rotation = model.transform.rotation;



I hope it helps! :D

Deploy Stage Once Script now broken

July 12, 2018 - 4:16pm #10

This is a bit confusing! Does this mean that there is no way for the user to re-track the plane to re-place the deploy plane once?

 

Or is the plane constantly being scanned and readjusted?  (In which case, we should parent all game objects to the Ground Plane Stage Vector3 0 then? 

Deploy Stage Once Script now broken

July 6, 2018 - 10:11am #9

Have you tried to disable the AnchorInputListener Behaviour? I am pretty sure this is what is capturing your input. In general, though - you should be able to disable the entire PlaneFinder GameObject if you are happy with the location of your Ground Plane Stage.

Deploy Stage Once Script now broken

July 4, 2018 - 11:53am #8

I am struggling with a similar issue. I am using Unity 2018.1.6f1 with Vuforia v 7.2.20. I want to place a grid plane once then use my own script that uses ray casting to place objects on my grid plane without the use of Vuforia's PositionContentAtPlaneAnchor method. In this version of Vuforia, the DeployStageOnce script is removed which I assume might have worked for me. I have unchecked the Duplicate Stage checkbox in the Content Positioning Behaviour script. This only allows me to place the content attached to the Ground Plane Stage once and thereafter it continues to detect the ground plane which is not what I want. While it continues to detect the ground plane if I tap the screen, it relocates the same content. I don't want this to happen. I just want to place my content (my grid plane) and then disable the Plane Finder Behaviour. I have tried to diasble the Plane Finder Behavior by script, but it seems to be persistent somehow. Is there anyway to disable the Plane Finder Behavior? 

Deploy Stage Once Script now broken

May 31, 2018 - 10:49am #7

robbiehunt wrote:

But what about those of us on 2017?

Same question. Have they updated Vuforia framework on pre Unity 2018 versions but left out the UI function to check/uncheck "Duplicate Stage"?

 

Why are 2017 users unable to use this DeployStateOnce script, nor toggle "Duplicate Stage"?

Deploy Stage Once Script now broken

May 5, 2018 - 4:49am #6

Hi Joey,

Thanks for this.

When you say "Parent the stage to the new GameObject like you would have the anchor before"

Do you mean before running the app, create a new GameObject in the Hierarchy and then parent the "Ground Plane Stage" object to it?

The code creates a GameObject at run-time. Correct? Why would we need to do it manually beforehand?

Could you elaborate please, as I am not sure I understand what I should do...

Thank you

Deploy Stage Once Script now broken

April 27, 2018 - 10:53am #5

But what about those of us on 2017?

Deploy Stage Once Script now broken

March 28, 2018 - 1:17pm #4

Hey there.

I made a work around for this since I am using the deploy stage once script to do quite a bit more than just lay a stage out - but I have an official response and my work around for you.



The official:

In 2018.1 the Deploy Stage Once script is no longer necessary. It is recommended for this version that you set up the PlaneFinder as normal and if you want to have deploy once behaviour, make sure the "Duplicate Stage" box is unchecked on the Content Positioning Behaviour component.



My workaround:

        // same anchor code from before

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

        // but now the anchor doesn't create a GameObject, so we will have to with the HitTestResult position and rotation values

        GameObject anchorGO = new GameObject();

        anchorGO.transform.position = result.Position;

        anchorGO.transform.rotation = result.Rotation;

        // Parent the stage to the new GameObject like you would have the anchor before

       if(anchor != null) {

            AnchorStage.transform.parent = anchorGO.transform;

            AnchorStage.transform.localPosition = Vector3.zero;

            AnchorStage.transform.localRotation = Quaternion.identity;

            AnchorStage.SetActive(true);

        }

        // Clean up

        if(_previousAnchor != null) {

            Destroy(_previousAnchor);

        }

         // Save it

        _previousAnchor = anchorGO;

This work around seems to be working exactly the same as before - not sure if there are any consequences of doing it this way, but it works and I'm on a deadline, so there it is, lol.

Best Regards,

-Joey

Deploy Stage Once Script now broken

March 27, 2018 - 9:11am #3

I'm on Unity 2017.3 and Vuforia 7.0.36 and it's not working for me anymore on device either although I don't get compilation errors during build. 

Help lol

Deploy Stage Once Script now broken

March 24, 2018 - 3:06am #2

Can confirm. Same problem here. Any answers?

Log in or register to post comments