Hello Sir, this is my code in .HTML file please say me where can i destroy trackable2Ds array/ object , so my application not be become crashes in iphone which runs fine in ipad. Please i am in problem from last 2days.
/* Global variables */ var logoTracker = null; var overlay = null; var trackable2DObject = null; var trackable2DObjects = new Array(); var errorOccured = false; var masterAnimationGroup = null; var trackerDataSetPath = null;
var targetIds = new Array();
//variable that keeps the jsonData received from the native app var jsonObject;
function error() { errorOccured = true; document.getElementById("messageElement").innerHTML = "Unable to load image or tracker!"; }
function createTracker(){ var image = new AR.ImageResource("target.png", {onError: error}); overlay = new AR.ImageDrawable(image, 1.0, {zOrder: 0});
// we need to pack the arrow animations into a parallel animation group to play them synchronisly masterAnimationGroup = new AR.AnimationGroup(AR.CONST.ANIMATION_GROUP_TYPE.PARALLEL, ); }
//function called from the native app fia callJavascript method //receives json-data as string and processes the contained information function newData(jsonData){
function trackerLoaded() { if (errorOccured) return;
document.getElementById("messageElement").style.display = "none"; // start with the parameter -1 indicates, that the group will play the animation in an infinite loop masterAnimationGroup.start(-1); }
function arrowWithDirectionality(offsetX, offsetY, roll) {
var animationOffset = 0.9; // distance in sdu's var animationTime = 700; // ms
// load the arrow image var arrowImage = new AR.ImageResource("DirectionArrow.png");
// attach the image resource to a drawable, so that its visible on the screen var arrowImageDrawable = new AR.ImageDrawable(arrowImage, 0.6, {offsetX: offsetX, offsetY: offsetY, zOrder: 1, roll: roll} );
// we want to animte the arrow, to lets add two animation var arrowSpinAnimation = new AR.PropertyAnimation(arrowImageDrawable, "tilt", 0, 360, animationTime, {type: AR.CONST.EASING_CURVE_TYPE.LINEAR});
// the first one moves the arrow to the trackableObject var arrowAnimationMoveDown = new AR.PropertyAnimation(arrowImageDrawable, "offsetX", offsetX, offsetX+animationOffset, animationTime, {type: AR.CONST.EASING_CURVE_TYPE.EASE_IN_CUBIC});
// the second one moves it back to the original position var arrowAnimationMoveUp = new AR.PropertyAnimation(arrowImageDrawable, "offsetX", offsetX+animationOffset, offsetX, animationTime, {type: AR.CONST.EASING_CURVE_TYPE.EASE_OUT_CUBIC});
// because these two animations should be played one after another, we gonna pack them into a sequential animation group. var animationGroup = new AR.AnimationGroup(AR.CONST.ANIMATION_GROUP_TYPE.SEQUENTIAL, );
var arrow = new Array(arrowImageDrawable, animationGroup);
I using this code, , so no image tracking is done ? and its right also because we destroy this object? so where i call this function? please suggest me?
You can call destroy whenever you're done using a specific tracker.
Best regards
Andreas
r
rahul soni
said
almost 10 years ago
IR mode, which uses more computing power (and battery power), is started whenever you create a Tracker. Thus make sure to call destroy() on the Tracker if you don?t require the IR instance anymore. If all Trackers are destroyed, IR mode is exited automatically.
So where to apply this destroy methos and how:?
r
rahul soni
said
almost 10 years ago
Thanks Andreas sir
Now i have another problem that my application beomes crashes agter 3-4 successful recognization of images, i think its because of not releasing object array of trackable2d Object's array and Architect object, i am not releasing Architect object because i am using ARC concept ,
So tell me how to release trackable2dObjects array which is in my .html file? and is it necessary to release ARchitect object, so my application will not be crashes?
help me.
A
Andreas Schacherbauer
said
almost 10 years ago
Hi,
1)
I'm not aware if this is possible, please check with qualcomm if you can create a dataset which contains multiple image targets with a qualcomm api.
2)
Since an architectworld is just like a regular html page, use javascript to access your webservice that will give you the names and image target urls that you need for creating the trackable2dobjects in javascript.
3)
Have a look at xmlhttprequest to connect to a webservice. Additionally libraries like jquery simplifies this.
Best regards
Andreas
r
rahul soni
said
almost 10 years ago
Thanks Andreas Sir,
Yes its works, i tested this.
Sir, Now i want to make an array of trackable2DObject and keep images reference in that array in it, so how to create trackable2DObject's Array and i want to reterieve images name and project name from webserver, because i want to track multiple images which is in my webserver.
1) I want to send multiple images in traceproject which would be ready for tracing from qualcom,Flow which i want is --> my all webserver images is 1st go to qualCom at a time and then ready to trace, then I download that traceble project.So, How to send all images at a time to qualcom and my all images become ready for tracing? please suggest me this first Sir?
2) Then if this happens successfully,i want to keep this traceble project in my database, and then reterieve images and project name from databse and send it to trackable2DObject's Array which is in my HTML file, this is the flow i want , How to achieve this Suggest me Sir.
is it possible to pass name of images and projectname in which this images lies to our .html file, how can i acheieve this please guide me or if you have any demo code so please provide
A
Andreas Schacherbauer
said
almost 10 years ago
Hi,
try this (untested)
trackable2DObject = new AR.Trackable2DObject(logoTracker, "Hut", { drawables: { cam: },
function generate(id) { document.location = "architectsdk://TrackerDidDiscoveredImageTarget?id="+id; }
I just want to reterieve the target name of recognized image,i.e which image from multiple images is recognized?
Please suggest me , give some sample code if possible that how to reterieve targetname from Trackable2DObject.
r
rahul soni
said
almost 10 years ago
Hello Sir,
My last one problem , How to set a unique id of recognized image , i have set two images in traceble and its properly recognized, but i want to set unique id to each image, please say me how can i do this because on basis of this id i want to open different pages in objective c?
Tell me what to edit in this to set id or how to set id=<aImageTargetID> in document.location = "architectsdk://TrackerDidDiscoveredImageTarget?id=<aImageTargetID>;... , so how to know aImageTargetID ?
r
rahul soni
said
almost 10 years ago
Thanks a lot Sir Andreas ,
My problem is solved , because you help me.
I used onEnterFieldOfVision this for calling method after image is recognized.
Thanks.
A
Andreas Schacherbauer
said
almost 10 years ago
Hi,
the overlay is an AR.ImageDrawable. According to the specification, you can add a onClick trigger function which is called each time you tap on the overlay.
As you can see in the SimpleIRWorld, there is the variable overaly:
var overlay = new AR.ImageDrawable(image, 1.0, {zOrder: 0});
You can define a onClick trigger like that:
overlay.onClick = function(){
alert('click on drawable');
// you can call any other JS function here
};
Best regards
Andreas
r
rahul soni
said
almost 10 years ago
Thanks Sir,
I have another problem that as in IR ImageRecognization, when image is recognized so an overlay of architect image is show and four arrows is shown, So can i call a javascript method on click of that overlay image when image is recognized.
Is this is possible then please tell me how to set architect overlay's click event and its calling a javascript method on its click..
rahul soni