By mr_savvy
on Wed, 06/20/2012 - 17:09
Hi everyone,
first of all, many compliments for the SDK, very very helpful. I'm planning to use it in future projects.
I created a project from ImageTarget project and I added three ImageTarget inside a dataset. I added the management of tapevent as described by ksiva in [url]https://ar.qualcomm.at/arforums/showpost.php?p=70&postcount=2[/url]. Everythink work great.
Now I want to manage the same event of "tap" on screen but on tapping the 3d object on the scene.
To reach this goal I want to add a virtual button on an ImageTarget. I edited the config file adding the tag inside the tag and adding in the "renderFrame" method somethinj like
// Did we find any trackables this frame?
for(int tIdx = 0; tIdx < state.getNumActiveTrackables(); tIdx++)
{
// Get the trackable:
const QCAR::Trackable* trackable = state.getActiveTrackable(tIdx);
modelViewMatrix =
QCAR::Tool::convertPose2GLMatrix(trackable->getPose());
/** start virtual button code **/
const QCAR::ImageTarget* target = static_cast(trackable);
const QCAR::VirtualButton* button = target->getVirtualButton(0);
if (button->isPressed())
{
LOG("-------- virtual button pressed -----------");
// here handle tap management
}
else
{
// here render objects
.....
}
I can't understand the behaviour of my code: I touch the object in the scene but nothing appens, in a second moment starts an infinite loop "------virtual button pressed-------".
I'm using
- the vuforia sdk 1.5.9.
- the teapot target image
Thanks a lot in advance.
Saverio
Re: Virtual button on ImageTarget