Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create objects with ground plane detection only once with Vuforia & Unity

I am trying to create an AR app using Unity & Vuforia. I have a 3D model that needs to be spawned when ground plane is detected.But this needs to happen only once. The way Vuforia work is, it keeps on spawning objects when new plane is detected. So what i need to do is either detect plane only once or spawn the object only once. As i am new to Unity, i need help doing this. Great if someone could tell me what i need to do to achieve this.

like image 309
Anup G Prasad Avatar asked Feb 06 '18 05:02

Anup G Prasad


2 Answers

Vuforia has updated.Now There is no DeploymentStageOnce script.Inorder to stop duplicating while we touch, we have to turn off Duplicate Stage in Content Positioning Behaviour (Script)Check the Inspector when we click Plane Finder. enter image description here

like image 198
zyonneo Avatar answered Sep 28 '22 06:09

zyonneo


In your app you should have a Plane Finder object somewhere with the following properties set by default
enter image description here

The Plane Finder object has a Behaviour component attached that calls a Position Content method if a plane was found. That method belongs to the Content Positioning Behaviour and it makes an instance (Clone) of your Ground Plane Stage. In order to avoid more than one instance you should import the vuforia Deploy Stage Once script located here: https://library.vuforia.com/articles/Solution/ground-plane-guide.html and you should change the Plane Finder Behaviour as the following:enter image description here

like image 28
Hristo Avatar answered Sep 28 '22 05:09

Hristo