Start a new topic

Enable and disable Trackable2DObject in runtime

Enable and disable Trackable2DObject in runtime



in order to change the enabled state of your Trackable2DObject at runtime you will need to set the enabled property.

Changing the global_enabled variable does not have any effect, as it is only used when initializing the object.

I believe the following snippet should work for your case:


var page3;

var World = {

  page3 = new AR.Trackable2DObject(this.tracker, "page3", {

    enabled : true,

    drawables: { cam: this.overlayOne }




function toggle_enabled() {

  if (page3.enabled) {

    page3.enabled = false;

  } else {

    page3.enabled = true;





DISCLAIMER: I did not test this nor am I particularly well versed in JavasScript, but I believe this should get the point across.



Kind reagrds


hi i'm trying to enable and disable Trackable2DObject in runtime but I can't. Can you help me? 

This is my code:


var global_enabled = true;

var World = {


  var page3 = new AR.Trackable2DObject(this.tracker, "page3", {

    enabled : global_enabled,

    drawables: { cam: this.overlayOne },




//external button change the variable "global_enabled" 

function toggle_enabled(){

    global_enabled = ! global_enabled;

Login or Signup to post a comment