Log in or register to post comments

Problem with Virtual button

November 14, 2012 - 11:36pm #1

I try to change coordinat of virtual button (in file xml on folder assets) . and it work. but when i try to change the coordinat in file VirtualButtons.cpp with same coordinat at file xml, some of my virtual buttons didn't work. and when i try to closer camera to marker one of my virtual button working alone.  i have been to change the sensitivity to high but it didn't work.

 

any idea with my problem?

 

Problem with Virtual button

November 26, 2012 - 1:55am #15

For virtual buttons coordinates, what I mean is:

you also need to modify the coordinates in the .CPP file, of course, if your application supports "Toggling" buttons on/off (i.e. like in the VirtualButtons sample, where you have Menu Options to toggle buttons on / off);

however (in a general App case), if your app does not provide support for Toggling buttons (i.e. if you remove the Toggle Menu Options from the VirtualButtons sample), in that case the virtual buttons coordinates do not need to be specified in the .CPP (as that is only meant for re-creating the buttons when toggling them); in that case editing the XML will be sufficient.

 

 

 

 

 

Problem with Virtual button

November 25, 2012 - 2:42am #14

it is possible to change the coordination only in the XML file? what problems might happens if coordinat in XML and VirtualButtons.cpp diffrent?

Problem with Virtual button

November 23, 2012 - 1:36am #13

Just manually edit the XML, no need to upload again.

Same for virtual button coords, editing the XML is sufficient (but if you also change the .CPP code, then don't forget to ndk-build and refresh in Eclipse).

 

Problem with Virtual button

November 23, 2012 - 1:11am #12

sorry, when you change the size of the target, you reupload marker to https://ar.qualcomm.at/projects, or just change the size of the target in the xml file without re-upload it?

Problem with Virtual button

November 22, 2012 - 5:58am #11

Hi,

actually for what concerns the XML target size, I only experience the problem when the size is not big enough, so with something around 52 x 68, it should work also for you (maybe you can increase still a bit more, but I was able to have it already good at 51.8 x 67.7); 

if you increase the size sufficiently, it should not be needed to modify the button coordinates.

 

For what concerns the second problem (buttons self-activating when you move the camera close to them), I have been able to reproduce it (sorry if I missed it before); 

I checked with our engineering team and it turns out to be a known issue; i.e. virtual buttons are not always completely reliable and under some particular circumstances they can behave in an unexpected way;

this is currently under investigation for improvement, although I cannot tell how soon it will be fixed.

 

 

Problem with Virtual button

November 21, 2012 - 11:17pm #10

i have been try to change imange size in XML file, and try to change coordinate of virtual button. but it didn't work. and how about problem, when i close camera with marker, and the button work by itself. any idea?

Problem with Virtual button

November 20, 2012 - 4:55am #9

Hi, I tested with your original target image and indeed I was able to reproduce your problem (with some of the buttons not working);

actually the problem comes from the fact that the virtual button borders are almost touching the image borders (and going slightly outside of the target image), so probably due to some accuracy issue some buttons are not activated.

You can fix that by increasing a little bit the target size in thr XML (e.g. I tried "51.8  67.7" instead of "51.17   67", and it solved the problem, having all buttons working)

or you can shift/shrink a little bit the buttons if you prefer.

 

The bottomline is that your buttons should be fully contained in your image.

Problem with Virtual button

November 20, 2012 - 3:24am #8

Hi, I'll check the data you sent me and get back to you.

Problem with Virtual button

November 19, 2012 - 8:54pm #7

i have been PM link of my marker to you. can you help me to identify the problem?

Problem with Virtual button

November 16, 2012 - 7:21am #6

Hi, I tried your code and XML and it seems to work fine.

However I had to change the ImageTarget size

(you set it to [50.1...  67], but that has a different aspect ratio then the image I'm using here for testing, i.e. your image has the width < height, but I don't have such a target here);

so I tried changing a bit the target size (to [95 67]) and see if it works, and it works fine.

If you like, you can PM me with a link to the image that you use, so I can create a target like yours and test again.

 

Problem with Virtual button

November 16, 2012 - 6:39am #5

this is the coordinate code in virtualbuttons.cpp file

 

if (buttonMask & BUTTON_1)
            {
                LOG("Toggle Button 1");
               
                toggleVirtualButton(imageTarget, virtualButtonColors[0],
                                    -24.09f, 26.84f, -13.12f, 30.96f);
                                   
            }
            if (buttonMask & BUTTON_2)
            {
                LOG("Toggle Button 2");
               
                toggleVirtualButton(imageTarget, virtualButtonColors[1],
                                    -24.09f, -26.84f, -13.12f, -30.96f);
            }
            if (buttonMask & BUTTON_3)
            {
                LOG("Toggle Button 3");
               
                toggleVirtualButton(imageTarget, virtualButtonColors[2],
                                    13.94f, -26.84f, 24.92f, -30.96f);
            }
            if (buttonMask & BUTTON_4)
            {
                LOG("Toggle Button 4");
               
                toggleVirtualButton(imageTarget, virtualButtonColors[3],
                                    13.94f, 26.84f, 24.92f, 30.96f);
            }

 

 

and this one the code in XML file

 

 <Tracking>
        <ImageTarget size="50.176212 67" name="MyMarker">
        <VirtualButton name="red" rectangle="-24.09 26.84 -13.12 30.96" enabled="true" />
        <VirtualButton name="blue" rectangle="-24.09 -26.84 -13.12 -30.96" enabled="true" />
        <VirtualButton name="yellow" rectangle="13.94 -26.84 24.92 -30.96" enabled="true" />
        <VirtualButton name="green" rectangle="13.94 26.84 24.92 30.96" enabled="true" />
        </ImageTarget>

Problem with Virtual button

November 16, 2012 - 6:01am #4

Hi, can you paste here the lines of code where you set the VB coordinates ?

(just the relevant lines of code that you have modified, not all the sample code...)

 

Problem with Virtual button

November 15, 2012 - 4:25am #3

So my problem happend when i try to make  same coordinates in VirtualButtons.cpp file and in the XML.

 

before that, i just change coordinates in the XML, and it work but not sensitive.

but because i saw in sample, coordinate in VirtualButtons.cpp file and in the XML same. i try to change coordinates in VirtualButtons.cpp similar to coordinates in the XML.

 

This problem makes some virtual buttons did not work. and the sensitivity of the virtual buttons that work is reduced. whereas the area was used as a virtual button I gave an additional different color to provide contrast between the background with virtual buttons. but this does not add to the sensitivity of the button, even when I try to hold the camera with markers, buttons executes the action itself while the area was not covered anything.


Problem with Virtual button

November 15, 2012 - 3:58am #2

Hi, not sure to entirely understand the problem,

but a few things to keep in mind:

in the VirtualButton.cpp file, the button coordinates are "reset" with hard-coded values when you call toggleVirtualButton();

however, in the sample, those hardcoded values are the same as the ones appearing in the XML;

if you want to change those coordinates in the code, be aware that that code change only becomes active once you toggle a button, 

otherwise your app will just use the values from the XML;

so, you will probably need to change you change your virtual buttons coordinates in more than one place in the code.

Log in or register to post comments