Log in or register to post comments

How To Load Object Using Virtual Button Regularly

September 26, 2013 - 5:03am #1

I am new unity vuforia programmer, can anyone give me a suggestion what should i do, when i want to load Clone of 3D objects regularly and they use virtual button to handle the event?

I want to make a game. My game looks like Ant Smasher Game. And here, i want to use virtual button.  So my game's player can interact with the 3D object directly. But until know, i have no idea what should i do. I had tried some method or algorithm, but it still not solved.
Can anyone give me some suggestion about what method or algorithm that i can use for this.?

Thank you for the respond, and i'm so sorry, because my english is bad.

How To Load Object Using Virtual Button Regularly

September 26, 2013 - 8:22pm #3

but until now, i cann't create a virtual button using method create virtual button in image target class.

I create the virtual button in a derived class of IVirtualButtonEventHandler. Here i create the virtual button after I instantiate the ant prefab. I use this in unity mono behaviour method update. it is something like this:

void Update () {	
		
		if (waktuCounter <= 0 && i!=1)
		{
			int ran = Random.Range(0,1);
			
			//instantiate the object
			mSemut = (GameObject)Instantiate(semut[i], posisi[ran], Quaternion.identity);
			
			//make object to child of image target
			mSemut.transform.parent = temp.transform;
			
			// Create a virtual button	
            VirtualButtonBehaviour vbb = ImageTargetBehaviour.CreateVirtualButton(vbName[i], mSemut.transform.localPosition, mSemut);
            vbb.RegisterEventHandler(this);
			
			i++;
			//set time for loading the object
			waktuCounter = waktu;
		}		
		
		waktuCounter-= Time.deltaTime;
	}

Is there anything wrong?

Thank you for your respond,

How To Load Object Using Virtual Button Regularly

September 26, 2013 - 1:34pm #2

I think you need to add the ants as prefabs, and everytime you click, just create instances of the prefab. 

Log in or register to post comments