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)
3D Model Questions or Problems
Loading 3D model near GeoLocation
L
Luca
started a topic
over 6 years ago
Loading 3D model near GeoLocation
4 Comments
Oldest First
Popular
Newest First
Sorted by
Oldest First
L
Luca
said
over 6 years ago
Hi,
I want to load all the POI and, when the user is near (about 2 meters) to a POI, I want to show him a 3D model...
I'm using the sample of Multiplepoi modified... This is the code
for(i=0;i< World.markerList.length;i++)
{
// Updating POI distance
var newLocation2 = World.markerList.markerLocation;
document.getElementById("page1").innerHTML = "a"+World.markerList.markerLocation;
var distanceUpdate2 = (newLocation2.distanceToUser() > 999) ? ((newLocation2.distanceToUser() / 1000).toFixed(2) + " km") : (Math.round(newLocation2.distanceToUser()) + " m");
document.getElementById("page1").innerHTML = "a"+distanceUpdate2;
World.markerList.descriptionLabel.text = distanceUpdate2;
// Loading 3D Model if distance is <= 2m
if (Math.round(newLocation2.distanceToUser()) <= 15)
{
var model = new AR.Model("3d/"+World.markerList.id+".wt3", {
onLoaded: function()
{
var geoObject = new AR.GeoObject(World.markerList.markerLocation);
geoObject.drawables.addCamDrawable(model);
document.location = "architectsdk://clickOnObject?param="+World.markerList.name;
//document.location = "architectsdk://clickOnCar";
//this.scale.x = 0.01;
//this.scale.y = 0.01;
//this.scale.z = 0.01;
},
/*onClick: function()
{
document.location = "architectsdk://clickOnObject?param="+World.markerList.name;
}*/
});
}
But finished to load the 3D model, an error occured: TypeError: 'undefined' is not an object (evaluating 'World.markerList.markerLocation')
onLoadedmultiplepois.js:88:99
triggerade.js:1:421464
That's why?
L
Luca
said
over 6 years ago
Sorry, I solved creating a new array with information of the nearest marker (model hadn't to load data from World.markerList)
O
Oyindamola Oluwatimi
said
over 6 years ago
Hi,
How did you exactly solve the problem? Could you demonstrate?
Thanks in advance.
L
Luca
said
over 6 years ago
Hi :)
in locationChanged I did this...
I iterated by all the markeList elements
for(i=0;i< World.markerList.length;i++)
Then I checked if I'm near the POI
if (Math.round(newLocation2.distanceToUser()) <= 5)
So I created a new var with the geoobject array
var markerNear = World.markerList;
And I used markerNear for all. So if you want show the model and delete the POI from the camera, do this
markerNear.markerObject.drawables.removeCamDrawable();
markerNear.markerObject.drawables.addCamDrawable(model);
And to undo this
markerNear.markerObject.drawables.removeCamDrawable(model);
markerNear.markerObject.drawables.addCamDrawable();
Login
or
Signup
to post a comment
More topics in
3D Model Questions or Problems
Question about wikitude studio
3D Model can't animate on Geo location
3D Modeling
KML upload won't save in world
Wikitude SDK 2.0: 3D content misplaced
3D lighting and material
.addCamDrawable() and 3D models
how to autorefresh a KML URL based world ?
3D model not showing in GPS sample
Problems AR.Model
See all 383 topics
© 2020
Wikitude
GmbH ·
Imprint
·
Legal
Luca