Start a new topic

[Android] AR.ActionRage and Camera Orientation

[Android] AR.ActionRage and Camera Orientation

Hello,
I am trying to use the AR.ActionRage in order to show/hide the geoobjects in a certain range, but i am having some difficulties.
For example in the example tutorial1.html we have:
function newData(jsonData){
jsonObject = JSON.parse(jsonData);
document.getElementById("statusElement").innerHTML='Loading JSON objects';
for(var i = 0; i (...)
geoLoc = new AR.GeoLocation(jsonObject.Point.latitude,jsonObject.Point.longitude,jsonObject.Point.altitude);
jsonObject.poiObj = new AR.GeoObject(geoLoc, {drawables: {cam: poidrawables}});
}
Where i have to put the action range?

Another question is related with the camera orientation. When i start the application sample or even the wikitude world browser the camera shows the image 90? rotated Anti-ClockWise. What can be causing this? I have an LG P500

Thanks
Best Regards
Hi,

you would need to create an AR.ActionRange object. e.g. var actionRange = new AR.ActionRange(location1, 500); where location1 would be an AR.GeoLocation object and 500 is the radius in meteres around this location. Whenever the user enters or exits this area the onEnter and onExit triggers of AR.ActionRange will be called. See AR.ActionRange/ActionArea in the library reference for more details.

About the rotation issue, can you post the Android version you are running and if you are seeing this on different phones as well.

Thanks
Hi,
The Android  version is: 2.3.3
I haven't tested in other phones

Thanks.
Best Regards
Hi Filipe,

Thanks for pointing this out.
We observed this behavior under certain circumstances on a small number of devices but were able to fix this issue and will publish it in upcoming SDK / Wikitude version.

Would be great if you can tell use if the issue is fixed on your device too in upcoming SDK update begin of Mai.

Sorry for inconvenience & thanks for assistance.

Kind regards,
Andreas
Hi,
When the new SDK version will be release ?

I am trying AR.ActionRange but i still not getting to work... I want to show the GeoObject only when is the range that i have defined.
I have something like this:var geoLoc = new AR.GeoLocation(jsonObject.Point.latitude,jsonObject.Point.longitude,jsonObject.Point.
var actionRange = new AR.ActionRange(geoLoc, 500);
jsonObject.poiObj = new AR.GeoObject(geoLoc, {drawables: {cam: poidrawables},                         triggers:{                           
onEnterFieldOfVision: function(){                               
this.enabled = actionRange.isInArea(geoLoc);                           
},
            onExitFieldOfVision: function(){
                  this.enabled = actionRange.isInArea(geoLoc);                           
}                       
}});
But all the objects are still showing despite the defined range.
What am i doing wrong?
Thanks
Hi Filipe,

the problem here is that you query isInArea with the GeoLocation used for creating the AR.ActionRange. So basically you are asking if the center of the action range lies within it. You will need to either use onEnter, onExit triggers to enable/disable the objects. Or use the current user's location (reported by AR.context.onLocationChanged) and pass it to isInArea().
Thanks for your reply Wolfgang, but could you please provide a working example?
basically this should do the trick:
var location = new AR.GeoLocation(14, 37);
var obj = new AR.GeoObject(location, ...); // create the GeoObject with location and drawables
var range = new AR.ActionRange(location, 500); // create ActionRange with 500 m radius

// define the onEnter trigger that is called if the user enters the area defined by the actionrange.
range.onEnter = function() {obj.enabled = true;};
// define the onExit trigger that is called if the user exits the area defined by the actionrange.
range.onExit = function() {obj.enabled = false;};

Hope that helps! Just reply if something is unclear.
Login or Signup to post a comment