Wikitude
play_for_work
Forum
FAQ
Documentation
Download
wikitude.com
How can we help you today?
Enter your search term here...
Search
Start a new topic
Discussions
Wikitude SDK (Android, iOS, UWP)
Wikitude SDK Questions or Problems
Enable and disable Trackable2DObject in runtime
S
Santiagoheisig
started a topic
almost 7 years ago
Enable and disable Trackable2DObject in runtime
2 Comments
Oldest First
Popular
Newest First
Sorted by
Oldest First
S
Santiagoheisig
said
almost 7 years ago
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;
}
D
Daniel Guttenberg
said
over 6 years ago
Hi,
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
Daniel
Login
or
Signup
to post a comment
More topics in
Wikitude SDK Questions or Problems
Instatiation of WTArchitectView compile errors
Point of interest - native iOS
Slider
Camera lagging / slow in native Swift application
Create a web service
N-th ImageDrawable not displayed
Radar Example
stop defaultlocationmanager and use architectview.injectlocation ios 10
WTC Size Limit
AngularJS and wikitude
See all 3869 topics
© 2021 Wikitude, a Qualcomm company
Santiagoheisig